Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Change Local Administrator password

$
0
0

I have a script that will change the local administrator account on multiple computers withe a get-content command which works great. But I need to have the script randomize the password on each system and then output the server name and password associated with it, which i cannot even think on where to start. Google has not been my friend with it.

Here is my Script:

$computers = Get-Content -path C:\server.txt

$changeuser = "admin account" $password = Get-Content C:\passwords.txt

Foreach($computer in $computers)

{

echo $computer

$user = [adsi]"WinNT://$computer/$changeuser,user" $user.SetPassword($Password)

$user.SetInfo()

 

Where should I start, do not even know where too.


Viewing all articles
Browse latest Browse all 6937

Trending Articles