KnarrStudio / ITPS.OMCS.FastCruise

A quick operational test of the workstations. Captures the date time and user that did the checks and stores the date.
GNU General Public License v3.0
1 stars 0 forks source link

Capture the Make and Model of the workstation #6

Closed OgJAkFy8 closed 4 years ago

OgJAkFy8 commented 4 years ago

$computerSystem = (Get-WmiObject -Class:Win32_ComputerSystem) Write-Host $computerSystem.Manufacturer Write-Host $computerSystem.Model

OgJAkFy8 commented 4 years ago

Added the following function:

    <#bookmark Workstation Information #>
    function Get-WorkstationInfo    
    {
      param(
        [Parameter(Position = 0)]
        [ValidateSet('Manufacturer','Model','Name','PrimaryOwnerName','Domain','serialnumber')] 
        [String]$Info
      )
      Write-Verbose -Message ('Enter Function: {0}' -f $PSCmdlet.MyInvocation.MyCommand.Name)

      if($Info -eq 'serialnumber'){
        (Get-WmiObject -Class win32_SystemEnclosure).serialnumber
      }
      else{
        (Get-WmiObject -Class:Win32_ComputerSystem).$Info

      }

    } # End Workstation Information-Function

Then the following code:

Write-Verbose -Message 'Getting Serial Number'
    $ComputerStat['SerialNumber'] = Get-WorkstationInfo -Info serialnumber

    Write-Verbose -Message 'Getting Serial Number'
    $ComputerStat['Manufacturer'] = Get-WorkstationInfo -Info Manufacturer

    Write-Verbose -Message 'Getting Serial Number'
    $ComputerStat['Model'] = Get-WorkstationInfo -Info Model
OgJAkFy8 commented 4 years ago

Completed.