Quantcast
Channel: foreach | Operating systems, scripting, PowerShell and security | jesusninoc.com
Viewing all articles
Browse latest Browse all 409

Create users with passwords on a remote computers

$
0
0

#Create users with passwords on a remote computers

#Important
#Need activate:
#PS C:WindowsSystem32WindowsPowerShellv1.0> C:WindowsSystem32svchost.exe -k NetworkService
#PS C:WindowsSystem32WindowsPowerShellv1.0> winrm quickconfig
#Execute PowerShell as administrator

#Content file user.txt:
#(line 1)pepito,pass1
#(line 2)juanito,pass2

$userandpass=Get-Content C:powershellfichero.txt
foreach($i in $userandpass)
{
$partiruserandpass=$i.Split(“,”)
Invoke-Command{ net user $partiruserandpass[0] /add $partiruserandpass[1]} -Computername computer
}

The post Create users with passwords on a remote computers appeared first on Security.


Viewing all articles
Browse latest Browse all 409

Trending Articles