Advertisement
fellwell5

Get-ComputerModel.ps1

Mar 22nd, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires -RunAsAdministrator
  2. $ComputerName = Read-Host -Prompt "Enter the computername"
  3. $Model = Read-Host -Prompt "Enter the computermodel"
  4. $query = "Select Model FROM Win32_ComputerSystem"
  5. Get-WmiObject -Namespace "root\cimv2" -ComputerName $ComputerName -Query $query
  6. If (-Not $Model -eq  ""){
  7.     $query = "Select * FROM Win32_ComputerSystem WHERE Model LIKE '%$Model%'"
  8.     Get-WmiObject -Namespace "root\cimv2" -ComputerName $ComputerName -Query $query
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement