Thursday, 6 March 2014

PowerShell Scripts - Functions Definition

Have Created one function which will fetch Operating Information for multiple computers.

Change the text file name accordingly.

Function Get-Osinfo {
BEGIN{}
Process{
                $computername = $_
                Get-wmiobject –class win32_operatingsystem –computer $computername | select-object BuildNumber, Caption, ServicePackMajorVersion
}
END{}
}

Get-content C:\computers.txt | get-osinfo

Regards
Baij

No comments:

Post a Comment

Install Multiple Software with a Click