locked
Export to CSV RRS feed

  • Question

  • 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()

    Friday, July 28, 2017 2:41 PM

All replies

  • Always start with help:

    help about_pipelines


    \_(ツ)_/

    Friday, July 28, 2017 2:53 PM
  • Hi jpcapone,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, August 21, 2017 9:17 AM
  • It took a little bit more than starting with help but I got this figured out, thanks.
    Friday, September 8, 2017 3:15 PM