AMC Posted April 14, 2022 Posted April 14, 2022 Hi Folks, I'm new to Pulsewau scripting, please bear with me. I've tried to run the following PowerShell command, but it doesnt seem to run. Rename-Computer -NewName "Computer123" -DomainCredential MyDomain\Administrator -Restart Any advice on what I should do, to rename a computer?
Administrators Paul Posted April 15, 2022 Administrators Posted April 15, 2022 Hi @AMC, Based on the documentation, the DomainCredential parameter says: Quote If you type a user name, this cmdlet prompts you for a password. We run PowerShell in a non-interactive mode, this prevents inputs from being triggered. You can provide a PSCredential object instead of the username and that should do the trick. $password = "ThisIsAPlaintextPassword" | ConvertTo-SecureString -asPlainText -Force $username = "contoso\Administrator" [PSCredential] $credential = New-Object System.Management.Automation.PSCredential($username, $password) Rename-Computer -NewName "NewComputerName" -DomainCredential $credential -Restart -Paul
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now