When I type the following script in PowerShell, the command gets executed without any error, but it prompts for username, password and again the name to add in the Users group for each PCs. how do I loop or array it, so it only prompts for the username, password and the name of the group only once and create the account in all three PCs, thanks.
$PC="PC01","PC02","PC03"
Invoke-Command $PC -ScriptBlock {New-LocalUser;Add-LocalGroupMember -Group "Users"}
it does not finish creating accounts in all PCs by just once instance of input for the user account.
I googled "Invoke-Command"; here is a very slightly modified copy/paste from the very first search result :p