Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-Info {
- param(
- [parameter(Mandatory)]
- [alias('hostname')]
- [string]$ComputerName
- )
- BEGIN{
- $status = @{1='Disabled';2 = 'Enabled';3 = 'NA';4 = 'Unknown'}
- }
- PROCESS{
- $AdminPasswordStatus = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -ExpandProperty AdminPasswordStatus
- $CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName | Select-Object -Property Domain,Model,Manufacturer
- $BS = Get-WmiObject -Class Win32_Bios -ComputerName $ComputerName | Select-Object -property SerialNumber
- $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName | Select-Object -Property Version,ServicePackMajorVersion
- $obj = [pscustomObject] @{
- ComputerName = $ComputerName;
- Domain = $CS.Domain;
- AdminPWStatus = $status.$adminPasswordStatus
- Model = $cs.Model;
- Manufacturer = $CS.Maanufacturer;
- SerialNumber = $BS.SerialNumber;
- Version = $OS.Version;
- ServicePack = $OS.ServicePackMajorVersion}
- }
- End{
- $obj
- }
- }
- Get-Info -ComputerName localhost -Verbose
Advertisement
Add Comment
Please, Sign In to add comment