Add LAST LOGGED IN USER to local admin group using a PDQ variable?
I'm wondering if there's a PDQ variable that we can use in a 'net localgroup /add' script that would specifically add the last logged on user to the local administrators group.
I know how to deploy a script that adds accounts that I specify, but it's tedious having to edit that job script for every deployment. It would be nice to run a single job that pulls that account name and plugs it into the script for each computer in a collection.
1
Comments
There's no native variable for this in PDQ, but you may be able to adapt the following script to help accomplish this.
https://github.com/pdq/PowerShell-Scanners/blob/master/PowerShell%20Scanners/User%20Last%20Logged%20On/User%20Last%20Logged%20On.ps1