Hello all,
I am attempting to change the admin account password of servers remotely using powershell. I have cobbled together the script below. I can run the script successfully and it echos successes and failures in the console. For auditing purposes,
I would like to export the results I see in the console to a csv but when I insert a pipe and export-csv I get an 'empty pipe is not allowed' error. I have researched this error but what I am finding hasn't really helped me resolve the issue. Any
suggestions would be appreciated.
$computers = Get-Content -path C:\computerlist.txt
$changeuser = "system_admin"
$password = "Spring2014!"
Foreach($computer in $computers)
{
echo $computer
$user = [adsi]"WinNT://$computer/$changeuser,user"
$user.SetPassword($Password)
$user.SetInfo()
}