A desktop support technician is writing a Windows PowerShell script (.ps1) to automate user workstation deployment. The script needs to check the value of the system environment variable named LOGONSERVER to verify which domain controller authenticated the current user session. Which of the following syntax constructs should the technician use to access this environment variable inside the PowerShell script?
- $env:LOGONSERVERCevap
- B%LOGONSERVER%
- C$LOGONSERVER
- Decho %LOGONSERVER%
Cevap
$env:LOGONSERVER
In Microsoft PowerShell (.ps1), environment variables are exposed via the environment drive provider and referenced using the env:LOGONSERVER.
Adım Adım Çözüm
Anahtar Kavram
PowerShell Environment Variable Syntax