Tuesday, 25 November 2008

Determine-Domain.ps1

# Determine-Domain.ps1
#
Uses Win32_ComputerSystem to determine the domain this computer is in
#
Recoded sample 1 from http://msdn.microsoft.com/en-us/library/aa394586
#
Thomas Lee - tfl@psp.co.uk

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

# Display details

"System Name: {0}" -f $computer.name
"Domain : {0}" -f $computer.domain

This script produces the following output:

PS C:\foo> .\determinedomain.ps1
System Name: COOKHAM8
Domain : cookham.net

0 comments: