Requirements :
1 . Powershell v3
2. save the list of computers in a text file and place it in root drive
C:\1\Computers.txt
Script
Function IEVersion {
$Prop = [ordered]@{}
$ComputerName = Cat C:\1\Computers.txt
$ErrorActionPreference = "Stop"
foreach ($computer in $ComputerName)
{
Try {
$Syntax = GWMI win32_operatingsystem -cn $computer
$Prop.Computername = $Syntax.CSName
$Prop.OperatingSystem = $Syntax.Caption
$Prop.ServicePack = $Syntax.CSDVersion
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer")
$Prop.IEVersion = $Regkey.GetValue("Version")
New-Object PSObject -property $Prop
}
Catch
{
Add-Content "$computer is not reachable" -path $env:USERPROFILE\Desktop\UnreachableHosts.txt
}
}
}
#HTML Color Code
#http://technet.microsoft.com/en-us/librProp/ff730936.aspx
$a = "<!--mce:0-->"
IEVersion | ConvertTo-HTML -head $a -body "<H2> IE Version</H2>" |
Out-File $env:USERPROFILE\Desktop\DomainController.htm #HTML Output
Invoke-Item $env:USERPROFILE\Desktop\DomainController.htm
1 . Powershell v3
2. save the list of computers in a text file and place it in root drive
C:\1\Computers.txt
Script
####################################################
Function IEVersion {
$Prop = [ordered]@{}
$ComputerName = Cat C:\1\Computers.txt
$ErrorActionPreference = "Stop"
foreach ($computer in $ComputerName)
{
Try {
$Syntax = GWMI win32_operatingsystem -cn $computer
$Prop.Computername = $Syntax.CSName
$Prop.OperatingSystem = $Syntax.Caption
$Prop.ServicePack = $Syntax.CSDVersion
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer")
$Prop.IEVersion = $Regkey.GetValue("Version")
New-Object PSObject -property $Prop
}
Catch
{
Add-Content "$computer is not reachable" -path $env:USERPROFILE\Desktop\UnreachableHosts.txt
}
}
}
#HTML Color Code
#http://technet.microsoft.com/en-us/librProp/ff730936.aspx
$a = "<!--mce:0-->"
IEVersion | ConvertTo-HTML -head $a -body "<H2> IE Version</H2>" |
Out-File $env:USERPROFILE\Desktop\DomainController.htm #HTML Output
Invoke-Item $env:USERPROFILE\Desktop\DomainController.htm
##########################################################
output
IE Version
Computername | OperatingSystem | ServicePack | IEVersion |
---|---|---|---|
TRAINER-PC | Microsoft Windows 7 Ultimate | Service Pack 1 | 9.10.9200.17609 |
No comments:
Post a Comment