Powershell Script to pull file Version remotely of multiple systems.
Put the computer names in abc.txt and save it in C drive.
Put the computer names in abc.txt and save it in C drive.
File path exist or not –
$colComputers = Get-Content C:\abc.txt
foreach ($StrComputer in $colComputers)
{
$GenItems1 = gwmi Win32_ComputerSystem -Comp $StrComputer
$x86Path = 'C:\Program Files (x86)\WinZip\WZCAB.DLL'
if(!$GenItems1){
Write-Host “$StrComputer not found”
}
else
{
Write-Host $StrComputer, (Get-Item $x86Path | Select -ExpandProperty VersionInfo).fileVersion
}
}
No comments:
Post a Comment