troubleshooting Question

Add User Name and Password in the Powershell command

Avatar of jskfan
jskfanFlag for Cyprus asked on
PowershellScripting Languages
12 Comments1 Solution172 ViewsLast Modified:
Add User Name and Password in the Powershell command

I have this command below that access a file on a computer named windows7 and replaces a string  username with white.
it works when the remote Windows7 computer is logged on with the same username and password I am logged on to this computer I am running Powershell command from.
However now the remote computer is logged on with username: JDock and Password : Passw0rd
how do I include the username and password inside the powershell command ?

Thank you

((Get-Content -path '\\windows7\c$\test.txt' -Raw) -replace ' username', 'white') | Set-Content -Path '\\windows7\C$\test.txt'
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros