Thursday, 6 March 2014

PowerShell Scripts

 Server inventory


Change the file and software name given in Bold according to your need.

$com = Get-Content C:\FileNAme.txt
foreach($computers in $com){
$cpu = Get-WmiObject -Class Win32_Processor -Computername $computers
$mb =  Get-WmiObject -Class Win32_BaseBoard -Computername $computers
$sn =  Get-WmiObject -Class win32_bios -Computername $computers
$cn =  Get-WmiObject -Class Win32_ComputerSystem -Computername $computers
$os =  Get-WmiObject -Class Win32_OperatingSystem -Computername $computers
$Office = Get-WmiObject -Class Win32_Product -Computername $computers | where {$_.Name -eq "Microsoft Office Standard 2007"}

$props = @{           
    Computername  = $cn.__Server
    SerialNo      = $sn.Serialnumber
    Model         = $cn.Model
    TotalPhysicalMemory = $cn.TotalPhysicalMemory / 1024 / 1024
    Os = $os.Caption
    IE = $IE.Version
    Office = $office.Name
   
    
    }

New-Object PSObject -Property $props | Ft -Autosize}

Regards,
Baij

No comments:

Post a Comment

Install Multiple Software with a Click