powershell alapok

We use this variable when there is a requirement for us to collect system related information like:

COMPUTERNAME,
HOMEDRIVE,
LOGONSERVER,
NUMBER_OF_PROCESSORS,
OS,
PROCESSOR_ARCHITECTURE,
PROCESSOR_IDENTIFIER,
PROCESSOR_LEVEL,
PROCESSOR_REVISION,
SESSIONNAME,
SystemDrive,
SystemRoot,
USERDNSDOMAIN,
USERDOMAIN,
USERNAME, USERPROFILE, windir.

So for collecting these kind of information and the like we will have to use $env variable.

For ex:
$env:COMPUTERNAME will display the hostname of the computer.
$env:LOGONSERVER will display the name of the server to which the user has logged in.
$env:USERDNSDOMAIN will display the name of the DNS Server
$env:USERNAME will display the name of the user who has logged in.
$env:USERPROFILE will display the path of the user profile.
$env:windir will display the path of the WINDOWS directory.

Be Sociable, Share!

Leave a reply