Gwith

So Far

May 15th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 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. }
  12.  
  13. PROCESS{
  14. Write-Verbose 'Start Process'
  15. $AdminPasswordStatus = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -ExpandProperty AdminPasswordStatus
  16. $CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -Property Domain,Model,Manufacturer
  17. $BS = Get-WmiObject -Class Win32_Bios -ComputerName $ComputerName | Select-Object -property SerialNumber
  18. $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName | Select-Object -Property Version,ServicePackMajorVersion
  19. switch ($AdminPasswordStatus)
  20. {
  21. 1 {$AdminPasswordStatus = 'Disabled'}
  22. 2 {$AdminPasswordStatus = 'Enabled'}
  23. 3 {$AdminPasswordStatus = 'NA'}
  24. 4 {$AdminPasswordStatus = 'Unknown'}
  25. default {'Try Again'}
  26. }
  27.  
  28. $Properties = @{
  29. 'Computer Name' = $ComputerName;
  30. 'Domain' = $CS.Domain;
  31. 'Model' = $cs.Model;
  32. 'Manufacturer' = $CS.Maanufacturer;
  33. 'SerialNumber' = $BS.SerialNumber;
  34. 'Version' = $OS.Version;
  35. 'ServicePack' = $OS.ServicePackMajorVersion}
  36. $obj = New-Object -TypeName PSObject $Properties
  37. }
  38.  
  39. End{
  40. Write-Verbose 'Start End'
  41. Write-Host $obj
  42. }
  43. }
  44.  
  45.  
  46.  
  47. Get-Info
Advertisement
Add Comment
Please, Sign In to add comment