Public/common.ps1
function GetDSEPMs { # query DSE's PMs from AD. $OU = "OU=VUTDCs,OU=pMachines,OU=Servers,DC=chn,DC=sponetwork,DC=com" $ADPMs = Get-ADComputer -SearchBase $OU -Filter * return $ADPMs.Name } function FindOutDSEPM { # to find out DSE's PM from list. param ([String[]]$PMachines) $Result = @() $DSEPMs = GetDSEPMs foreach ($pm in $PMachines) { if ($pm -in $DSEPMs) { $Result += $pm if ($DSEPMs.Count -eq $Result.Count) { break } } } return $Result } function Get-Servers { param( $Search ) return Get-ADComputer -Filter {Name -Like $Search -AND OperatingSystem -notlike "*Standard*"} | select -expand name } |