Gwith

test

May 16th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. function Get-Info {
  2. param(
  3. [parameter(Mandatory)]
  4. [alias('hostname')]
  5. [string]$ComputerName
  6. )
  7.  
  8. BEGIN{
  9. $status = @{1='Disabled';2 = 'Enabled';3 = 'NA';4 = 'Unknown'}
  10. }
  11.  
  12. PROCESS{
  13. $AdminPasswordStatus = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -ExpandProperty AdminPasswordStatus
  14. $CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -Property Domain,Model,Manufacturer
  15. $BS = Get-WmiObject -Class Win32_Bios -ComputerName $ComputerName | Select-Object -property SerialNumber
  16. $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName | Select-Object -Property Version,ServicePackMajorVersion
  17.  
  18. $obj = [pscustomObject] @{
  19. ComputerName = $ComputerName;
  20. Domain = $CS.Domain;
  21. AdminPWStatus = $status.$adminPasswordStatus
  22. Model = $cs.Model;
  23. Manufacturer = $CS.Maanufacturer;
  24. SerialNumber = $BS.SerialNumber;
  25. Version = $OS.Version;
  26. ServicePack = $OS.ServicePackMajorVersion}
  27. }
  28.  
  29. End{
  30. $obj
  31. }
  32. }
  33.  
  34.  
  35.  
  36. Get-Info -ComputerName localhost -Verbose
Advertisement
Add Comment
Please, Sign In to add comment