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: support/azure/virtual-machines/windows/serial-console-cmd-ps-commands.md
+28-28Lines changed: 28 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ This article provides example commands to perform common tasks in scenarios in w
23
23
24
24
SAC is included in all versions of Windows since Windows Server 2003. By default, however, it's disabled. SAC relies on the `sacdrv.sys` kernel driver, the `Special Administration Console Helper` service (`sacsvr`), and the `sacsess.exe` process. For more information, see [Emergency Management Services Tools and Settings](/previous-versions/windows/it-pro/windows-server-2003/cc787940(v%3dws.10)).
25
25
26
-
SAC enables you to connect to your running OS through a serial port. When you open a Command Prompt window in SAC, `sacsess.exe` starts `cmd.exe` within your running OS. In Task Manager, you can see that if, at the same time, you also connect through RDP to your VM, you're now connected to SAC through the serial console feature. The CMD window that you access through SAC is the same as the `cmd.exe` window that you use when you connect through RDP. All the same commands and tools are available, including the ability to start PowerShell from that CMD instance. The major difference between SAC and the Windows Recovery Environment (WinRE) is that SAC lets you manage your running OS, but WinRE starts up into a different, minimal OS. Although Azure VMs don't support the ability to access WinRE, they can be managed through SAC.
26
+
SAC enables you to connect through a serial port to the running OS. When you open a Command Prompt window in SAC, `sacsess.exe` starts `cmd.exe` within your running OS. In Task Manager, you can see that if, at the same time, you also connect through RDP to your VM, you're now connected to SAC through the serial console feature. The CMD window that you access through SAC is the same as the `cmd.exe` window that you use when you connect through RDP. All the same commands and tools are available, including the ability to start PowerShell from that CMD instance. The major difference between SAC and the Windows Recovery Environment (WinRE) is that SAC lets you manage your running OS, but WinRE starts up into a different, minimal OS. Although Azure VMs don't support the ability to access WinRE, they can be managed through SAC.
27
27
28
28
Because SAC is limited to an 80x24 pixel screen buffer that has no scroll back capability, add `| more` to commands to display the output one page at a time. Use `<spacebar>` to see the next page, or `<enter>` to see the next line.
29
29
@@ -49,7 +49,7 @@ To view and edit Windows registry settings by using CMD, follow these steps:
**Note:** The second key (under \Policies) is necessary only if the relevant Group Policy setting is configured. The value will be rewritten at next Group Policy refresh if it's configured in Group Policy.
52
+
**Note:** The second key (under \Policies) is necessary only if the relevant Group Policy setting is configured. The value is rewritten at next Group Policy refresh if it's configured in Group Policy.
53
53
54
54
## Use CMD to manage Windows services
55
55
@@ -153,7 +153,7 @@ When limited to methods available in Windows by default, PowerShell can be a bet
153
153
154
154
`netsh advfirewall set allprofiles state off`
155
155
156
-
You can use this command when troubleshooting to temporarily rule out the Windows Firewall. It will be enable on next restart or when you enable it using the following command. Don't stop the Windows Firewall service (MPSSVC) or Base Filtering Engine (BFE) service as a way to rule out the Windows Firewall. Stopping MPSSVC or BFE results in all connectivity being blocked.
156
+
You can use this command when you troubleshoot to temporarily rule out Windows Firewall. Firewall will be enabled at the next restart or when you enable it by using the command in the next section. Don't stop the Windows Firewall service (MPSSVC) or Base Filtering Engine (BFE) service as a method to rule out the Windows Firewall. Stopping MPSSVC or BFE causes all connectivity to be blocked.
157
157
158
158
### Enable Windows Firewall
159
159
@@ -173,7 +173,7 @@ You can use this command when troubleshooting to temporarily rule out the Window
173
173
174
174
`net user <username> | find /i "active"`
175
175
176
-
Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. It won't usually be`Administrator`.
176
+
Azure VMs that are created from a generalized image have the local administrator account renamed to the name that's specified during VM provisioning. Usually, the name isn't`Administrator`.
177
177
178
178
### Enable user account
179
179
@@ -229,7 +229,7 @@ Use `604800000` to look back seven days instead of 24 hours.
229
229
230
230
`wevtutil qe security /c:1 /f:text /q:"Event[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and EventID=4624 and TimeCreated[timediff(@SystemTime) <= 604800000]] and EventData[Data[@Name='TargetUserName']='<username>']]" | more`
231
231
232
-
## View or Remove Installed Applications using CMD
232
+
## View or remove installed applications by using CMD
233
233
234
234
### List installed applications
235
235
@@ -241,15 +241,15 @@ The `sort /r` command sorts results in descending order by install date, making
241
241
242
242
`wmic path win32_product where name="<name>" call uninstall`
243
243
244
-
Replace `<name>` with the name returned in the above command for the application you want to remove.
244
+
Replace `<name>` with the name that's returned in the previous command for the application that you want to remove.
245
245
246
246
## File System Management using CMD
247
247
248
248
### Get file version
249
249
250
250
`wmic datafile where "drive='C:' and path='\\windows\\system32\\drivers\\' and filename like 'netvsc%'" get version /format:list`
251
251
252
-
This example returns the file version of the virtual NIC driver, which is netvsc.sys, netvsc63.sys, or netvsc60.sys depending on the Windows version.
252
+
This example returns the file version of the virtual network adapter driver, which is netvsc.sys, netvsc63.sys, or netvsc60.sys depending on the Windows version.
253
253
254
254
### Scan for system file corruption
255
255
@@ -288,9 +288,9 @@ When using `/restore`, specify the parent folder of the one used in
288
288
289
289
## Manage Devices
290
290
291
-
### Remove non-present PNP devices
291
+
### Remove entries for nonexistent PNP devices
292
292
293
-
This command cleans up device entries for hardware no longer present on the system:
293
+
This command cleans up device entries for hardware that no longer exists on the system:
@@ -361,13 +361,13 @@ If this command returns to a prompt with no output, then the module wasn't loade
361
361
362
362
`get-module psreadline`
363
363
364
-
If the above command returns the PSReadLine module version, run the following command to unload it. This command doesn't delete or uninstall the module. It only unloads it from the current PowerShell session.
364
+
If the previous command returns the PSReadLine module version, run the following command to unload it. This command doesn't delete or uninstall the module. It only unloads it from the current PowerShell session.
365
365
366
366
`remove-module psreadline`
367
367
368
-
If PSReadLine is loaded, it may introduce extra characters when pasting text. To avoid this, unload the module using `remove-module psreadline`.
368
+
If PSReadLine is loaded, it may introduce extra characters when you paste text. To avoid this, unload the module by using `remove-module psreadline`.
369
369
370
-
## View and Edit Windows Registry Settings using PowerShell
370
+
## View and Edit Windows Registry Settings by using PowerShell
371
371
372
372
### Verify RDP is enabled
373
373
@@ -383,7 +383,7 @@ The second key under `\Policies` exists only if the relevant Group Policy settin
The second key (under \Policies) would be needed only if the relevant group policy setting had been configured. Value will be rewritten at next group policy refresh if it's configured in group policy.
386
+
The second key (under \Policies) would be needed only if the relevant group policy setting was configured. The value will be rewritten at next group policy refresh if it's configured in group policy.
387
387
388
388
## Manage Windows Services using PowerShell
389
389
@@ -419,7 +419,7 @@ When using a service account other than `NT AUTHORITY\LocalService`, `NT AUTHORI
419
419
420
420
## Manage Networking Features using PowerShell
421
421
422
-
### Show NIC properties
422
+
### Show network adapter properties
423
423
424
424
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | format-list status,name,ifdesc,macadDresS,driverversion,MediaConNectState,MediaDuplexState`
425
425
@@ -458,7 +458,7 @@ or
458
458
> [!NOTE]
459
459
> The Write-Progress cmdlet might not work by using this command. As a mitigation, you can run `$ProgressPreference = "SilentlyContinue"` in PowerShell to disable the progress bar.
`Set-NetFirewallProfile` is available in 2012 and later versions. For 2008 R2, use `netsh advfirewall` as referenced in the CMD section above.
505
+
`Set-NetFirewallProfile` is available in 2012 and later versions. For 2008 R2, use `netsh advfirewall` as referenced in the CMD section earlier in this article.
506
506
507
507
## Manage Users and Groups using PowerShell
508
508
@@ -514,11 +514,11 @@ or
514
514
515
515
`(get-localuser | where {$_.SID -like "S-1-5-21-*-500"}).Enabled`
516
516
517
-
or
517
+
Or
518
518
519
519
`(get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'").Disabled`
520
520
521
-
`Get-LocalUser` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`. This example shows the built-in local administrator account, which always has SID `S-1-5-21-*-500`. Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. So it will usually not be`Administrator`.
521
+
`Get-LocalUser` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`. This example shows the built-in local administrator account. This account always has SID `S-1-5-21-*-500`. Azure VMs that are created from a generalized image have the local administrator account renamed to the name that's specified during VM provisioning. Usually, the name isn't`Administrator`.
522
522
523
523
### Add local user to local group
524
524
@@ -528,17 +528,17 @@ or
528
528
529
529
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
530
530
531
-
This example enables the built-in local administrator account, which always has SID `S-1-5-21-*-500`. Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. So it will usually not be`Administrator`.
531
+
This example enables the built-in local administrator account. This account always has SID `S-1-5-21-*-500`. Azure VMs that are created from a generalized image have the local administrator account renamed to the name specified during VM provisioning. Usually, the name isn't`Administrator`.
532
532
533
533
### View user account properties
534
534
535
535
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | format-list *`
`Get-LocalUser` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`. This example shows the built-in local administrator account, which always has SID `S-1-5-21-*-500`.
541
+
`Get-LocalUser` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`. This example shows the built-in local administrator account. This account always has SID `S-1-5-21-*-500`.
542
542
543
543
### View local groups
544
544
@@ -572,7 +572,7 @@ Use `604800000` to look back seven days instead of 24 hours. |
572
572
573
573
`get-winevent -logname system -maxevents 1 -filterxpath "*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and EventID=4624 and TimeCreated[timediff(@SystemTime) <= 604800000]] and EventData[Data[@Name='TargetUserName']='<username>']]" | more`
574
574
575
-
## View or Remove Installed Applications using PowerShell
575
+
## View or remove iInstalled applications by using PowerShell
576
576
577
577
### List installed software
578
578
@@ -582,7 +582,7 @@ Use `604800000` to look back seven days instead of 24 hours. |
@@ -622,11 +622,11 @@ Returns uptime as `<days>:<hours>:<minutes>:<seconds>:<milliseconds>`, for examp
622
622
623
623
Adding `-force` forces running applications to close without warning users.
624
624
625
-
## Instance Metadata
625
+
## Instance metadata
626
626
627
627
You can query Azure instance metadata from within your Azure VM to view details such as osType, Location, vmSize, vmId, name, resourceGroupName, subscriptionId, privateIpAddress, and publicIpAddress.
628
628
629
-
Querying instance metadata requires healthy guest network connectivity because it makes a REST call through the Azure host to the instance metadata service. If you're able to query instance metadata, that means that the guest can communicate over the network to an Azure-hosted service.
629
+
Querying instance metadata requires healthy guest network connectivity because it makes a REST call through the Azure host to the instance metadata service. If you can query instance metadata, then the guest can communicate over the network to an Azure-hosted service.
630
630
631
631
For more information, see [Azure Instance Metadata service](/azure/virtual-machines/windows/instance-metadata-service).
0 commit comments