Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. $ADComputers = Get-ADComputer -filter * -SearchBase "OU=TESTOU,dc=domain,dc=com" -Properties *
  2. #Run foreach user.
  3. foreach ($ADComputer in $ADComputers) {
  4. #Skip offline PC's
  5. if (!($ADComputer).IPv4Address) {
  6. Write-host ('ERROR: Device is offline ' + ($ADComputer.CN) + '!') -ForegroundColor yellow
  7. continue
  8. }
  9. #Script to run on online PC
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement