On Windows, how do I set an environment variable for a user other than the currently logged in one? I need to set the
TMP variable to change the temporary directory used by an ASP.NET app.
You can access through the registry. Modify the
\Environment\Tmp key in
Here are two solutions for getting the account SID
$User = New-Object System.Security.Principal.NTAccount("domainname", "username") $SID = $User.Translate([System.Security.Principal.SecurityIdentifier]) $SID.Value
Get-WmiObject win32_useraccount -Filter "name = 'username' AND domain = 'domainname'"