I have a PowerShell .PS1 script that I am trying to get to apply via a logon script with Group Policy. Here is the .PS1 script (very simple, just adds the user to RD Users group):
net localgroup "Remote Desktop Users" "$env:USERDOMAIN\$env:USERNAME" /add
GPresult, the GPO is getting applied without issue. I can run the PS1 manually and it works (albeit as Admin and with
Set-ExecutionPolicy Unrestricted). However, the script is not working, because the user logging in never gets added to the "Remote Desktop Users" group.
RSoP.msc under "last executed" time it is blank for the script. I'd like to look in Event Viewer to get a better idea of why the script isn't working, but am not sure what to look for exactly.
EDIT: Apparently the logon script must run as the logged on user, so it inherits whatever permissions said user has (or rather, does not have). I am going to try and run the script computer-side to see if it will work without the end-user having local admin rights since it will be using a system account.