How to get Image Number and Task Sequence number from remote workstations RRS feed

  • Question

  • Good day

    How do i Image Number and Task Sequence number from remote workstations.

    I have this code which gets all the workstation information.  But this line only give me the Image name and task sequence number for local machine only.  $computerModel = get-itemproperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation -Name Model.

    Any help would be greatly appreciated

    Thank you

    Image and Task Sequence

    # For multiple workstations - You must run Powershell in elevated state (Run as Administrator), then run this script again

    Import-Module ActiveDirectory

    $ArrComputers =  "."  #Import-Csv C:\Scripts\Computername.txt
    #Specify the list of PC names in the line above. "." means local system

    foreach ($Computer in $ArrComputers)

    # Loop over each computer name
    #$results = foreach($Computer in $ArrComputers)
        # Set up a remote session to the machine in question
            $ComputerSession = New-CimSession -ComputerName $Computer

    # Fetch all the information from it
            $computerSystem = Get-CimInstance CIM_ComputerSystem -CimSession $ComputerSession
            $computerBIOS = Get-CimInstance CIM_BIOSElement -CimSession $ComputerSession
            $computerOS = Get-CimInstance CIM_OperatingSystem -CimSession $ComputerSession
            $computerCPU = Get-CimInstance CIM_Processor -CimSession $ComputerSession
            $computerHDD = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID = 'C:'" -CimSession $ComputerSession
            $OperatingSystem = get-wmiobject Win32_operatingsystem -computer $Computer
            #$computerModel = get-itemproperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation -Name Model
            $Sucess = $true
    write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
    write-host `a"Script Created By Michael J McKay 13 May 2017" -ForegroundColor Yellow
    write-host "The job continues on..." -BackgroundColor Red
        } catch {
            Write-Warning "Unable to fetch information from $Computer"
            $Success = $false
        # Create a new object containing all the details you want
            New-Object psobject -Property @{
                "Name"             = $computersystem.Name
                "ComputerName"     = $computersystem.Name
                "Manufacturer"     = $computerSystem.Manufacturer
                "Model"            = $computerSystem.Model
                "Serial Number"    = $computerBIOS.SerialNumber
                "CPU"              = $computerCPU.Name
                "HDD Capacity"     = "{0:N2}GB" -f ($computerHDD.Size/1GB)
                "HDD Space"        = "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size)
                "HDD Free"         = "{0:N2}GB" -f ($computerHDD.FreeSpace/1GB)
                "RAM"              = "{0:N2}GB" -f ($computerSystem.TotalPhysicalMemory/1GB)
                "Operating System" = "{0}, Service Pack: {1}" -f $computerOS.caption,$computerOS.ServicePackMajorVersion
                "User logged In"   = $computerSystem.UserName
                "Last Reboot"      = $computerOS.LastBootUpTime
        #else {
         #   New-Object psobject -Property @{
          #      "ComputerName"     = $Computer
    #$results | Export-Csv C:\Users\Mike\Desktop\ComputerDetails.csv

    • Moved by Bill_Stewart Friday, July 7, 2017 7:12 PM This is not "fix/debug/rewrite/add feature(s) to this script I found on the Internet" forum
    Sunday, June 11, 2017 2:35 AM

All replies

  • Perhaps you could ask the person who wrote the scrip to fix it for you.  We do not fix scripts found on the Interenet.

    For SCCM issues post in the SCCM forum.

    If you need a script that gets this information look here for working scripts:


    • Edited by jrv Sunday, June 11, 2017 3:18 AM
    Sunday, June 11, 2017 3:16 AM