<#
.SYNOPSIS
.DESCRIPTION
This script will validate the installed services, applications, patches, Drivers and other system info
.NOTES
=============================================================================================================================================
Created with: Windows PowerShell ISE
Created on: 10, 2017 10:02:54 PM
Created by: Dashrath Chate
Organization: Organization Name
=============================================================================================================================================
#>
$DataOut="";
$hostnames = $env:COMPUTERNAME
foreach ($hostname in $hostnames)
{
try
{
$SystemInfodetail=Get-WmiObject -Class Win32_OperatingSystem -ComputerName $hostname
$CheckInfo=Get-WMIObject –class Win32_ComputerSystem -ComputerName $hostname
$PatchesInfo=Get-HotFix -ComputerName $hostname
$AppsInfo=Get-WmiObject -Class Win32_Product -ComputerName $hostname
$SRouts=Get-Service -ComputerName $hostname
$DriversInfo=Get-WmiObject Win32_PnPSignedDriver -ComputerName $hostname | select devicename, driverversion
$DataOut=$DataOut+"`nMachine Name:
"+$hostname+"`n"
$DataOut=$DataOut+"Name,Status,DisplayName,StartType
`n"
foreach ($SRout in $SRouts)
{$DataOut=$DataOut+""+$SRout.Name+","+$SRout.Status+","+$SRout.DisplayName+","+$SRout.StartType+ "`n"
}
$DataOut=$DataOut+"`nPatchesInformation
`n"
$DataOut=$DataOut+"HotFixID,Description,InstalledBy,InstalledOn
`n"
foreach ($Patches in $PatchesInfo)
{$DataOut=$DataOut+""+$Patches.HotFixID+","+$Patches.Description+","+$Patches.InstalledBy+","+$Patches.InstalledOn+"`n"
}
$DataOut=$DataOut+"`nApplicationInformation
`n"
$DataOut=$DataOut+"IdentifyingNumber,Name,vendor,Version,Caption
`n"
foreach ($Apps in $AppsInfo)
{$DataOut=$DataOut+""+$Apps.IdentifyingNumber+","+$Apps.Name+","+$Apps.vendor+","+$Apps.Version+","+$Apps.Caption+"`n"
}
$DataOut=$DataOut+"`nDriversInformation
`n"
$DataOut=$DataOut+"Devicename,driverversion
`n"
foreach ($Drivers in $DriversInfo)
{$DataOut=$DataOut+""+$Drivers.Devicename+","+$Drivers.driverversion+"`n"
}
$DataOut=$DataOut+"`nSystemInformation
`n"
$DataOut=$DataOut+"SystemDirectory,Organization,BuildNumber,RegisteredUser,SerialNumber,Version
`n"
foreach ($SystemInfo in $SystemInfodetail)
{ $DataOut=$DataOut+""+$SystemInfo.SystemDirectory+","+$SystemInfo.Organization+","+$SystemInfo.BuildNumber+","+$SystemInfo.RegisteredUser+","+$SystemInfo.SerialNumber+","+$SystemInfo.Version+"`n"
}
$DataOut=$DataOut+"Domain,Model,Manufacturer
`n"
foreach ($CheckName in $CheckInfo)
{$DataOut=$DataOut+""+$CheckName.Domain+","+$CheckName.Model+","+$CheckName.Manufacturer+"`n"}
}
catch
{
$failureMsg=$_.Exception.Message
$DataOut=$DataOut+"`nHostName: "+$hostname+”,”+"$failureMsg"+"`n"
}
Set-Content -Path C:\Windows\CCM\Logs\$hostnames.csv -Value $DataOut
}
Write-Host "Data is available at C:\Windows\CCM\Logs\$hostnames.csv"
No comments:
Post a Comment
Leave your valuable words here for improve better.