diff --git a/driver.ps1 b/driver.ps1 index 400c085..6d26aac 100644 --- a/driver.ps1 +++ b/driver.ps1 @@ -34,6 +34,7 @@ function GetTools ($cd, $downloads) { gci -file $downloads | ?{$_.name -like "*bluespawn*"} | %{Copy-Item $_.fullname $cd\SharingIsCaring\tools} if (Test-Path $downloads\Sysinternals\) { Copy-Item $downloads\Sysinternals\sdelete.exe $cd + Copy-Item $downloads\Sysinternals\TCPVCon.exe $cd\SharingIsCaring\tools Copy-Item $downloads\Sysinternals\PSExec.exe $cd\SharingIsCaring\tools Copy-Item $downloads\Sysinternals\sdelete.exe $cd\SharingIsCaring\tools Copy-Item $downloads\Sysinternals\Autoruns.exe $cd\SharingIsCaring\tools @@ -275,6 +276,7 @@ $DCList = $(Get-ADComputer -Filter {OperatingSystem -like "*Windows*"} -SearchBa $ServersList | Select -ExpandProperty Name >> servers.txt $DCList | Select -ExpandProperty Name >> servers.txt +$DCList | Select -ExpandProperty Name >> dc.txt $job1 = Start-Job -ScriptBlock { param($downloads) @@ -376,4 +378,5 @@ ChangeAdminPass Write-Host "The program has completed successfully. Now, Manually update the group policy configuration on all computers in the domain" -ForegroundColor Green gpmc.msc DeleteDriver $cd -gpupdate /force \ No newline at end of file +gpupdate /force +powershell diff --git a/invoke-massadministration.ps1 b/invoke-massadministration.ps1 index 4f95162..3cc0bfa 100644 --- a/invoke-massadministration.ps1 +++ b/invoke-massadministration.ps1 @@ -37,7 +37,15 @@ function RunCommand ($ServersList, $cmd) { } } } - +function Netstat() +{ + $Netstat = (Netstat -ano | Select -skip 2) -Join "`n" -Split "(?= [TU][CD]P\s+(?:\d+\.|\[\w*:\w*:))" | + % {$_.trim() -Replace "`n",' ' -Replace '\s{2,20}',','} | + ConvertFrom-Csv + $Netstat | Add-Member -MemberType NoteProperty -Name Path -Value "" + $Netstat | %{$_.Path = $(ps -id $_.pid | Select -ExpandProperty path)} + $Netstat| ?{$_.Path -ne $null} | ft -Autosize -Wrap +} function ChangeAdminPass () { Write-Host "Setting a new administrator password" -ForegroundColor Yellow $newPass Read-Host "Please set a new password for $(whoami):" -AsSecureString @@ -48,4 +56,4 @@ function ChangeAdminPass () { # Vars $ServersList = Get-Content -Path "$(pwd)\servers.txt" # Logic -RunCommand ($ServersList, $cmd) \ No newline at end of file +RunCommand ($ServersList, $cmd)