Modify PS Script to add distinguished name RRS feed

  • Question

  • Hello,

         I have been using the following script to scan a large list of computer names, 5000, to gather their Internet Explorer version information. It has been working fairly well. Now they want the distinguished name of the computer so we can filter on it and distribute the results to the appropriate site and tech based upon the OU information in the distinguished name.

    Can someone help me add that information?

    Function IEVersion {
    $Prop = [ordered]@{}
    $ComputerName = Cat C:\temp\ComputerNames.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 
      Add-Content "$computer" -path $env:USERPROFILE\Desktop\UnreachableHosts4.txt
    #HTML Color Code
    $a = "<!--mce:0-->"
    IEVersion | ConvertTo-HTML -head $a -body "<H2> IE Version</H2>" | 
    Out-File $env:USERPROFILE\Desktop\IE_Versions.htm #HTML Output
    Invoke-Item $env:USERPROFILE\Desktop\IE_Versions.htm

    • Edited by MikeNostrom Thursday, February 18, 2016 6:27 PM more detail in title
    Thursday, February 18, 2016 6:15 PM


All replies