Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Powershell Script for getting OS Info for servers in a network range

$
0
0

Hi Friends,

We've scripted the below PowerShell script for getting OS info like "server-name, OS Description, Build-Version, Service Pack details" from a list of servers (Ip ranges is gven in servers.txt). I've got the O\P successfully in a HTML format, with little disturbances in table & headings name as property names. How can I change CSname(or PSComputerName) as HOSTNAME & Caption(or Description) as OSDescription. Your advice will be very much helpful.

*********************************************************************************

Set-ExecutionPolicy RemoteSigned -ErrorAction SilentlyContinue

$ComputerName = Get-content -path "C:\Users\Administrator\Servers.txt"

$OS = Get-WmiObject -Class Win32_OperatingSystem -computername $ComputerName | Select -Property CSName, Caption , Version, ServicePackMajorVersion | ConvertTo-Html -Fragment

ConvertTo-Html -Body "<font color = blue><H4><B>Operating System Information</B></H4></font>$OS" -CssUri  "$filepath\style.CSS" -Title "OS Information" | Out-File "C:\Users\Administrator\OSINFO.html"

Invoke-Item -Path "C:\Users\Administrator\OSINFO.html"

 

**************************************************************


Viewing all articles
Browse latest Browse all 6937

Trending Articles