Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ADComputers = Get-ADComputer -filter * -SearchBase "OU=TESTOU,dc=domain,dc=com" -Properties *
- #Run foreach user.
- foreach ($ADComputer in $ADComputers) {
- #Skip offline PC's
- if (!($ADComputer).IPv4Address) {
- Write-host ('ERROR: Device is offline ' + ($ADComputer.CN) + '!') -ForegroundColor yellow
- continue
- }
- #Script to run on online PC
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement