You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/troubleshooting/reset-local-password-without-agent.md
+18-94Lines changed: 18 additions & 94 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,73 +25,23 @@ You can reset the local Windows password of a VM in Azure using the [Azure porta
25
25
## Overview of the process
26
26
The core steps for performing a local password reset for a Windows VM in Azure when there is no access to the Azure guest agent is as follows:
27
27
28
-
1. Delete the source VM. The virtual disks are retained.
28
+
1. Stop the affected VM.
29
+
1. Create a snapshot for the OS disk of the VM.
30
+
1. Create a copy of the OS disk from the snapshot.
31
+
1. Attach and mount the copied OS disk to another Windows VM, then create some config files on the disk. The files will help you to reset the password.
32
+
1. Unmount and detach the copied OS disk from the troubleshooting VM.
33
+
1. Swap the OS disk for the affected VM.
29
34
30
-
2. Attach the source VM's OS disk to another VM on the same location within your Azure subscription. This VM is referred to as the troubleshooting VM.
31
-
32
-
3. Using the troubleshooting VM, create some config files on the source VM's OS disk.
33
-
34
-
4. Detach the VM's OS disk from the troubleshooting VM.
35
-
36
-
5. Use a Resource Manager template to create a VM, using the original virtual disk.
37
-
38
-
6. When the new VM boots, the config files you create update the password of the required user.
39
-
40
-
> [!NOTE]
41
-
> You can automate the following processes:
42
-
>
43
-
> - Creating the troubleshooting VM
44
-
> - Attaching the OS disk
45
-
> - Re-creating the original VM
46
-
>
47
-
> To do this, use the [Azure VM Recovery Scripts](https://github.com/Azure/azure-support-scripts/blob/master/VMRecovery/ResourceManager/README.md). If you choose to use the Azure VM Recovery Scripts, you can use the following process in the "Detailed steps" section:
48
-
> 1. Skip steps 1 and 2 by using the scripts to attach the OS disk of the affected VM to a recovery VM.
49
-
> 2. Follow steps 3–6 to apply the mitigations.
50
-
> 3. Skip steps 7–9 by using the scripts to rebuild the VM.
51
-
> 4. Follow steps 10 and 11.
52
-
53
-
## Detailed steps for Resource Manager
35
+
## Detailed steps for the VM with Resource Manager deployment
54
36
55
37
> [!NOTE]
56
38
> The steps do not apply to Windows domain controllers. It only works on standalone server or a server that is a member of a domain.
57
39
58
-
Always try to reset a password using the [Azure portal or Azure PowerShell](reset-rdp.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) before trying the following steps. Make sure you have a backup of your VM before you start.
40
+
Always try to reset a password using the [Azure portal or Azure PowerShell](reset-rdp.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) before trying the following steps. Make sure you have a backup of your VM before you start.
59
41
60
-
1. Delete the affected VM in Azure portal. Deleting the VM only deletes the metadata, the reference of the VM within Azure. The virtual disks are retained when the VM is deleted:
61
-
62
-
* Select the VM in the Azure portal, click *Delete*:
2. Attach the source VM’s OS disk to the troubleshooting VM. The troubleshooting VM must be in the same region as the source VM's OS disk (such as `West US`):
67
-
68
-
1. Select the troubleshooting VM in the Azure portal. Click *Disks* | *Attach existing*:
3. Connect to the troubleshooting VM using Remote Desktop and ensure the source VM's OS disk is visible:
85
-
86
-
1. Select the troubleshooting VM in the Azure portal and click *Connect*.
87
-
88
-
2. Open the RDP file that downloads. Enter the username and password of the troubleshooting VM.
89
-
90
-
3. In File Explorer, look for the data disk you attached. If the source VM’s VHD is the only data disk attached to the troubleshooting VM, it should be the F: drive:
91
-
92
-

93
-
94
-
4. Create `gpt.ini` in `\Windows\System32\GroupPolicy` on the source VM’s drive (if gpt.ini exists, rename to gpt.ini.bak):
42
+
1. Take a snapshot for the OS disk of the affected VM, create a disk from the snapshot, and then attach the disk to a troubleshoot VM. For more information, see [Troubleshoot a Windows VM by attaching the OS disk to a recovery VM using the Azure portal](troubleshoot-recovery-disks-portal-windows.md).
43
+
2. Connect to the troubleshooting VM using Remote Desktop.
44
+
3. Create `gpt.ini` in `\Windows\System32\GroupPolicy` on the source VM’s drive (if gpt.ini exists, rename to gpt.ini.bak):
95
45
96
46
> [!WARNING]
97
47
> Make sure that you do not accidentally create the following files in C:\Windows, the OS drive for the troubleshooting VM. Create the following files in the OS drive for your source VM that is attached as a data disk.
@@ -107,7 +57,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](rese
5. Create `scripts.ini` in `\Windows\System32\GroupPolicy\Machines\Scripts\`. Make sure hidden folders are shown. If needed, create the `Machine` or `Scripts` folders.
60
+
4. Create `scripts.ini` in `\Windows\System32\GroupPolicy\Machines\Scripts\`. Make sure hidden folders are shown. If needed, create the `Machine` or `Scripts` folders.
111
61
112
62
* Add the following lines the `scripts.ini` file you created:
113
63
@@ -119,7 +69,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](rese
3. Select your source VM OS VHD and click the *Copy* button next to the *URL* name:
151
-
152
-

153
-
154
-
9. Create a VM from the source VM’s OS disk:
155
-
156
-
1. Use [this Azure Resource Manager template](https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-specialized-vhd-new-or-existing-vnet) to create a VM from a specialized VHD. Click the `Deploy to Azure` button to open the Azure portal with the templated details populated for you.
157
-
158
-
2. If you want to retain all the previous settings for the VM, select *Edit template* to provide your existing VNet, subnet, network adapter, or public IP.
84
+
6. In Azure portal, detach the disk from the troubleshooting VM.
159
85
160
-
3. In the `OSDISKVHDURI` parameter text box, paste the URI of your source VHD obtain in the preceding step:
161
-
162
-

86
+
7. [Change the OS disk for the affected VM](troubleshoot-recovery-disks-portal-windows.md#swap-the-os-disk-for-the-vm).
163
87
164
-
10. After the new VM is running, connect to the VM using Remote Desktop with the new password you specified in the `FixAzureVM.cmd` script.
88
+
8. After the new VM is running, connect to the VM using Remote Desktop with the new password you specified in the `FixAzureVM.cmd` script.
165
89
166
-
11. From your remote session to the new VM, remove the following files to clean up the environment:
90
+
9. From your remote session to the new VM, remove the following files to clean up the environment:
167
91
168
92
* From %windir%\System32
169
93
* remove FixAzureVM.cmd
@@ -263,7 +187,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](http
263
187
264
188
1. Select the troubleshooting VM in the Azure portal, click *Disks*.
265
189
266
-
2. Select the data disk attached in step 2, click *Detach:*, then click *OK*.
190
+
2. Select the data disk attached in step 2, click **Detach**, then click **OK**.
@@ -27,11 +27,14 @@ You can't log in to the VM, and you receive a message that indicates that the pa
27
27
28
28
## Manual password reset procedure
29
29
30
-
1. Delete the VM and keep the attached disks.
30
+
> [!NOTE]
31
+
> The following steps does not apply to the VM with unmanaged disk.
31
32
32
-
2. Attach the OS Drive as a data disk to another temporal VM in the same location.
33
+
1. Take a snapshot for the OS disk of the affected VM, create a disk from the snapshot, and then attach the disk to a troubleshoot VM. For more information, see [Troubleshoot a Windows VM by attaching the OS disk to a recovery VM using the Azure portal](troubleshoot-recovery-disks-portal-linux.md).
33
34
34
-
3. Run the following SSH command on the temporal VM to become a super-user.
35
+
2. Connect to the troubleshooting VM using Remote Desktop.
36
+
37
+
3. Run the following SSH command on the troubleshooting VM to become a super-user.
35
38
36
39
```bash
37
40
sudo su
@@ -95,9 +98,9 @@ You can't log in to the VM, and you receive a message that indicates that the pa
95
98
umount /tempmount
96
99
```
97
100
98
-
11. Detach the disk from the management portal.
101
+
11. In Azure portal, detach the disk from the troubleshooting VM.
99
102
100
-
12. Recreate the VM.
103
+
12.[Change the OS disk for the affected VM](troubleshoot-recovery-disks-portal-linux.md#swap-the-os-disk-for-the-vm).
0 commit comments