About us

IIS covers the IT solutions to the issues come across now and then in a company IT infrastructure including Operating system, Softwares, Scriptings, securities and reviews.

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