I am trying to create a simple script that prompts a local admin user to create a local user account on 6 remote computers in a Windows Workgroup. The script should prompt for the name of the user, password, and the group to which it will be a member of, and repeats the execution of the commands in all 6 computers while the script initiated only once. All 6 computers have the admin account with the same username/password.
I know the PS commands that can be used are - New-LocalUser, Add-LocalGroupMember and PSSession, but I just can’t make it automated enough to run with the minimal input by a local admin.
I tried the following script and saved it on PC01 to run from Powershell. However it gives an error that account already exists whenever it tries to create the account on PC02 and PC03 after it successfully creates the account on PC01. Also it does not Read host when remoting in to PCs.
Why don’t you update your already existing thread?
and again:
When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you potentially wasting their time.
Thanks
And again:
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
( !! Sometimes the preformatted text button hides behind the settings gear symbol. )
Since you did not format your code and your code looks like it is one big line it’s hard to say where exactly your issue is. There should be line breaks at least.
The cmdlet
is made for interactive use. If you want to remote into another computer from a script you should use