Tuesday, 25 November 2008


    Uses Win32_ComputerSystem to determine the domain this computer is in
    This script is a re-write of an MSDN sample (sample three
    from  http://msdn.microsoft.com/en-us/library/aa394586) that uses
    Win32_computer name to determine the domain.
    File Name  : Get-Domain.ps1
    Author     : Thomas Lee - tfl@psp.co.uk
    Requires   : PowerShell V2
    Script posted to:
    MSDN Sample at:
    PSH [C:\foo]: .\Get-Domain.PS1'
    System Name: COOKHAM8
    Domain     : cookham.net

# Start of script

# Get details of this computer
$computer =  Get-WmiObject -Class Win32_ComputerSystem

# Display details
"System Name: {0}" -f $computer.name
"Domain     : {0}" -f $computer.domain
# End of script

No comments: