The following PowerShell script recipe will help you check a remote file based on a list of computers stored in a text file. During the session a PowerShell function will be created which will be piped into the text file with computers.
In the following PowerShell example I will check if install.exe exists on the remote systems and echo the computername if the file is there.
Create new text file named C:\Scripts\Active_Computers.txt and populate the file with computer names.
function check-remotefile { PROCESS { $file = "\\$_\c$\install.exe" if (test-path $file) { echo "$_ file install.exe exists" } } } Get-Content C:\Scripts\Active_Computers.txt | check-remotefile
Johan
How would one make this a vbscript instead of powershell?
Need a vbscript that check a list of computernames, if there’s a specific file under c:\program files\myapp
Ivan Versluis
Hi Johan,
I used this before. Let me check if I can find something in my own library.
Jim Lehane
I also wanted to use this for Vbscript instead of powershell? Do you have it for Vbscript?
Tony
Hi Ivan
Nice script! How could I add the functionality to search for specific multiple files on a remote computer?
Tony
Nice Script!
How can I add functionality to get the LastWriteTime, DateModified, CreationDate of the remote file?
Maelito
Great script and works beautifully
I have added the line just to look good
Write-Host “$_” -Foregroundcolor Green
Maelito