-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Invoke-Command -ComputerName 'boe-pc' -ScriptBlock {Get-ChildItem Cert:\LocalMachine\My | Where {$_.NotAfter -lt (Get-Date).AddDays(14)}} | ForEach { | ||
|
||
[pscustomobject]@{ | ||
|
||
Computername = $_.PSComputername | ||
Subject = $_.Subject | ||
ExpiresOn = $_.NotAfter | ||
|
||
DaysUntilExpired = Switch ((New-TimeSpan -End $_.NotAfter).Days) { | ||
{$_ -gt 0} {$_} | ||
Default {'Expired'} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[7/24/2019 3:55 PM] Aul, Steve L: | ||
No Title | ||
$Names = Get-ChildItem -Path F:\TestUsers2 | ?{ $_.PSIsContainer } | Select-Object Name | ||
foreach ($Name in $Names) | ||
{ | ||
Get-ChildItem -Path "f:\TestUsers2\User1" -Recurse -exclude Z_Scans | Select -ExpandProperty FullName | Where {$_ -notlike '*Z_Scans*'} | sort length -Descending | Remove-Item -Recurse -WhatIf | ||
} | ||
|
||
|
||
$FullNames = Get-ChildItem -Path F:\TestUsers2 | ?{ $_.PSIsContainer } | Select-Object FullName | ||
foreach ($FullName in $FullNames) | ||
{ | ||
Get-ChildItem $FullName -Recurse -exclude Z_Scans | Select -ExpandProperty FullName | Where {$_ -notlike '*Z_Scans*'} | sort length -Descending | Remove-Item -Recurse -WhatIf | ||
} | ||
|
||
|
||
|
||
$Names = Get-ChildItem -Path F:\TestUsers2 | Where-Object { $_.PSIsContainer } | Select-Object Name | ||
|
||
foreach ($Name in $FullNames) | ||
{ | ||
$parentpath = "F:\TestUsers2\" | ||
$A = Get-ChildItem -Path "$parentpath\$Name" | ||
Write-Host $A | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
Foreach ($_ in 1..13){Remove-JobTrigger -name ResetIIS -TriggerId $_} | ||
|
||
|
||
|
||
|
||
$svrlist = get-content C:\scripts\Output\svrlist2.txt | ||
$svrlist | ForEach-Object { | ||
Write-Output "Checking: $_" | ||
Get-WmiObject -Class Win32_Product -ComputerName $_ | where { $_.name -like '*netbackup*' -or $_.name -like '*rubrik*' } | Select-Object Pscomputername, Name, Version } | ||
|
||
|
||
Get-WmiObject -Class Win32_Product -ComputerName crd-dc-wp01 | where { $_.name -like 'carbon*' } | ||
|
||
$sites | ForEach-Object { New-ADOrganizationalUnit "LRD"+$_ -Path "OU=z-ParkerMigration-US,DC=LORD,DC=LOCAL" -Server crd-dc-wp01 } | ||
|
||
|
||
|
||
|
||
|
||
$sites = Get-Content C:\Scripts\Input\Sites-NA.txt | ||
|
||
$sites | ForEach-Object { | ||
$letter1 = ((65..90) | Get-Random -Count 1 | ForEach-Object { [char]$_ }).ToString() | ||
$letter1 = $letter.ToUpper() | ||
$letter1 | ||
|
||
$letter2 = ((65..90) | Get-Random -Count 1 | ForEach-Object { [char]$_ }).ToString() | ||
$letter2 = $letter.ToUpper() | ||
$letter2 | ||
|
||
$num = Get-Random (0..10) | ||
|
||
$DIVLOC = -join ('LRD', $num, $letter1, $letter2) | ||
|
||
$temp = -join ($DIVLOC, "_", $_) | ||
New-ADOrganizationalUnit $temp -Path "OU=z-ParkerMigration-US,DC=LORD,DC=LOCAL" -Server crd-dc-wp02 -Credential $cred | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
function Get-UnlinkedGPOs { | ||
<# | ||
.Synopsis | ||
.Description | ||
.Parameter Server | ||
.Example | ||
.Notes | ||
NAME: Get-UnlinkedGPOs | ||
AUTHOR: Mike Kanakos | ||
VERSION: 1.0.0 | ||
DateCreated: 2019-09-03 | ||
DateUpdated: 2019-09-03 | ||
v 1.0.0 - initial function creation | ||
.Link | ||
https://github.com/compwiz32/PowerShell | ||
#> | ||
|
||
[CmdletBinding()] | ||
Param( | ||
[alias('DC', 'DomainController', 'Computer', 'IPAddress')] | ||
[Parameter( | ||
AttributeValues)] | ||
[String]$server | ||
|
||
) | ||
|
||
$GPOXML = Get-GPOReport -all -ReportType xml -Server $server | ||
|
||
$List = New-Object -TypeName XML | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Function Get-AllGPO { | ||
Get-GPOReport -all -ReportType xml | % { | ||
([xml]$_).gpo | Select-Object name, @{n = "SOMName"; e = { $_.LinksTo | % { $_.SOMName } } }, @{n = "SOMPath"; e = { $_.LinksTo | % { $_.SOMPath } } } | ||
} | ||
} |