Gwith

2ndEdition

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