Last active
June 1, 2018 20:24
-
-
Save steviecoaster/33a47184b56ec8bbff7c348e99c36301 to your computer and use it in GitHub Desktop.
Query for file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Computers = Get-ADComputer -Filter * | Select Name | |
$file = /path/to/file | |
Foreach($c in $computers) { | |
#Uncomment to use UNC | |
If((Test-Path "\\$($c.Name)\C$\$file")){ | |
#uncomment to use remoting | |
#If(Invoke-Command -Computer $c.Name -Command { (Test-Path $args[0])} -ArgumentList $file){ | |
[pscustomobject]$cDetail = [ordered]@{ | |
Name = $c.Name | |
IP = Resolve-DNSName $c.Name | Select-Object -ExpandProperty IPAddress | |
} | |
} | |
$cDetail | Format-Table -AutoSize | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment