各位大大好
小弟公司最近被XX公司警告超裝軟體
想清查公司多少電腦有裝該軟體
目前打算建置Open-Audit
但是這件事有點急迫性
想盡快清查出數量
所以用AD去下這指令去查該軟體的安裝路徑
Test-Path "\\192.168.1.1\c$\Program Files\XXXXXXX\"
但是公司有很多網段
請問有辦法掃IP範圍嗎?
麻煩各位大大們解惑
寫個powershell ps1檔
2..254 | %{
$IP = "192.168.1.$_"
$path = "\\$IP\C$\Program Files\XXXXXX\"
If ([System.IO.Directory]::Exists($path) ) {
echo $path installed
}else{
echo $path no installed
}
}
$patch='網網路磁碟路徑'
$a="$env:COMPUTERNAME"
$Software='HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
$Software1='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
Get-ItemProperty $Software\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize |Out-File "$patch\$a_32.txt"
Get-ItemProperty $Software1\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize|Out-File "$patch\$a_64.txt"