Skip to content

Instantly share code, notes, and snippets.

@jpda
Created September 24, 2015 18:17
Show Gist options
  • Select an option

  • Save jpda/375707054983fbdb429e to your computer and use it in GitHub Desktop.

Select an option

Save jpda/375707054983fbdb429e to your computer and use it in GitHub Desktop.
Windows 10 IoT Password/Name Change
Param (
[string]$IP,[string]$Name,[string]$Password
)
$stockPass = ConvertTo-SecureString "p@ssw0rd" -AsPlainText -Force # Default password
$securePass = ConvertTo-SecureString $Password -AsPlainText -Force # new target password
$stockCreds = New-Object System.Management.Automation.PSCredential("$IP\Administrator", $stockPass)
$newCreds = New-Object System.Management.Automation.PSCredential("$IP\Administrator", $securePass)
Get-Service -Name WinRM | Start-Service -Verbose # Ensure WS-Man is started
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "$IP,$Name" -Force -Verbose # Add the target machine to your trusted hosts
#change password
Invoke-Command -ComputerName $IP -Credential $stockCreds -ScriptBlock {
& net user Administrator $using:Password # built-in net command in Windows
} -Verbose
#change name
Invoke-Command -ComputerName $IP -Credential $newCreds -ScriptBlock {
& setcomputername $using:Name # simple utilities in W10 IoT
& shutdown /r /t 0
} -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment