How to Reset a Domain Controller’s Domain Admin password for a Virtual Machine running up in Azure


The Reset password utility for Virtual Machines has come in handy on the odd occasion when we never recorded or misplaced the password for a VM running in Azure. The downside is this tool does not support running against Domain Controllers (to reset the in-built Administrator account).  So what happens when you have a domain controller, that only has a single Domain Admin account and we’ve forgotten the password?  In comes Virtual Machines Extensions to the rescue.  Firstly, open up Notepad and enter a net user reset password command like below replacing the username and password with the one you want to reset.  Save it as script.ps1

net user <Username> <Password>

Log into the Azure Portal and then select the Virtual Machine  you want to change domain password for, under the main menu blade for that Virtual Machine find Extensions and enter it.  We now want to add in a new Extension so click on the +Add button at the top, in the Add Extension blade, find and select Script Extension and click on Create.

This will now allow us to upload the script.ps1 we created earlier, so browse to it and then hit Upload.  This will then trigger the script to run in the Virtual Machine and we’ll get notified when it is created and run.


2 responses to “How to Reset a Domain Controller’s Domain Admin password for a Virtual Machine running up in Azure”

  1. raphsoeiro Avatar

    I don’t know you but I love you! You saved my weekend!

    1. John Avatar
      John

      Glad that helped.

Leave a Reply

More Posts

Getting a list of users in Active Directory as well as their Logon Script using dsquery and dsget

So I’m preparing on doing a clean-up of our NETLOGON/SYSVOL folder containing about 50 or so different logon scripts (plenty of which I know are no longer used).  I wanted to create a list of all of our active directory users along with what logon script they were assigned (I could then feed this list […]

Connection closed gracefully error when sending bulk or large quantity of e-mails in an Exchange 2007/2010 environment

I was recently helping out an old work colleague who were having issues with their CRM software and sending bulk emails through their Exchange 2010 server. After around ten minutes they would receive an error message with connection closed gracefully.  They would then have to restart their mail out and need to monitor it for […]

Extracting Reporting data from your DirectAccess Server to CSV using PowerShell

I recently had to extract some data from our DirectAccess server to get information about a particular user and their number of connections during a time period along with data transferred. The Remote Access Management Console allows you to view these details but not extract or save them. So I turned to PowerShell and used […]