Scenario
You want to find out what software is installed on the computers in your organization. You can use PowerShell to do this.First open PowerShell ISE and paste the following code in the script portion.
$list = Import-Csv "C:\TEMP\computers.csv"
foreach ($entry in $list)
{
try
{
$machinename = $entry.pcname
$SrvPath = "\\server\share"
$Date = Get-Date -UFormat %m-%d-%y
$FileName = "$machinename" + "_" + "$Date" + ".csv"
Get-WmiObject Win32_Product -ComputerName $machinename | Select-Object PSComputerName,Name,Vendor,Version | Export-Csv C:\$FileName -NoTypeInformation
}
catch [Exception]
{
}
}
foreach ($entry in $list)
{
try
{
$machinename = $entry.pcname
$SrvPath = "\\server\share"
$Date = Get-Date -UFormat %m-%d-%y
$FileName = "$machinename" + "_" + "$Date" + ".csv"
Get-WmiObject Win32_Product -ComputerName $machinename | Select-Object PSComputerName,Name,Vendor,Version | Export-Csv C:\$FileName -NoTypeInformation
}
catch [Exception]
{
}
}