Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Script to add current user to local administrator group

$
0
0

I would like to know if it is possible spawn a command prompt as a local administrator with a script in a secure way.

Ideally, the script could be copied to any users desktop, and double-clicking it would spawn a command prompt running as the local administrator account.

Running the following command will spawn a command prompt running as an administrator, but the credentials are in plain text, and it requires you to type in the username and computer name for each computer

psexec \\ComputerNameGoesHere -u ComputerNameGoesHere\administrator -p PasswordGoesHere cmd.exe

I would be alright with it being a powershell script, but the execution policy is set to restricted by default, so that would need to be compensated for.

Ideally, a single batch or powershell script that would do the following.

  1. User double clicks script
  2. Window pops up...

Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>