Skip to content

Commit 3aba919

Browse files
authored
Revise CMD and PowerShell commands documentation
Edit review per CI 7097
1 parent 7efb5d9 commit 3aba919

1 file changed

Lines changed: 43 additions & 41 deletions

File tree

support/azure/virtual-machines/windows/serial-console-cmd-ps-commands.md

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,109 +15,111 @@ ms.author: jarrettr
1515
ms.custom: sap:VM Admin - Windows (Guest OS)
1616
---
1717

18-
# Windows Commands - CMD and PowerShell
18+
# How to use CMD and PowerShell Windows commands
1919

2020
**Applies to:** :heavy_check_mark: Windows VMs
2121

22-
This section includes example commands for performing common tasks in scenarios where you may need to use SAC to access your Windows VM, such as when you need to troubleshoot RDP connection failures.
22+
This article provides example commands to perform common tasks in scenarios in which you have to use the Special Administration Console (SAC) to access your Windows virtual machine (VM). For example, you might have to use SAC to troubleshoot RDP connection failures.
2323

24-
SAC has been included in all versions of Windows since Windows Server 2003 but is disabled by default. 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)).
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)).
2525

26-
SAC allows you to connect to your running OS via serial port. When you launch CMD from SAC, `sacsess.exe` launches `cmd.exe` within your running OS. You can see that in Task Manager if you RDP to your VM at the same time you're connected to SAC via the serial console feature. The CMD you access via SAC is the same `cmd.exe` you use when connected via RDP. All the same commands and tools are available, including the ability to launch PowerShell from that CMD instance. That is a major difference between SAC and the Windows Recovery Environment (WinRE) in that SAC is letting you manage your running OS, where WinRE boots into a different, minimal OS. While Azure VMs don't support the ability to access WinRE, with the serial console feature, Azure VMs can be managed via SAC.
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 you connect through RDP to your VM at the same time as you're 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.
2727

28-
Because SAC is limited to an 80x24 screen buffer with no scroll back, 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.
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.
2929

30-
`SHIFT+INSERT` is the paste shortcut for the serial console window.
30+
The paste shortcut for the serial console window is `SHIFT+INSERT`.
3131

32-
Because of SAC's limited screen buffer, longer commands may be easier to type out in a local text editor and then pasted into SAC.
32+
Because of SAC's limited screen buffer, it might be easier to manage longer commands by copying them from a local text editor to SAC.
3333

34-
## View and Edit Windows Registry Settings using CMD
34+
## Use CMD for Windows registry settings
3535

36-
### Verify RDP is enabled
36+
To view and edit Windows registry csettings by using CMD, follow these steps:
3737

38-
`reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections`
38+
1. Verify that RDP is enabled by running the following commands:
3939

40-
`reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections`
40+
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
4141

42-
The second key (under \Policies) will only exist if the relevant group policy setting is configured.
42+
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections
4343

44-
### Enable RDP
44+
**Note:** The second key (under \Policies) exists only if the relevant Group Ppolicy setting is configured.
45+
46+
1. Enable RDP by running the following commands:
4547

46-
`reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0`
48+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0
4749

48-
`reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections /t REG_DWORD /d 0`
50+
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections /t REG_DWORD /d 0
4951

50-
The second key (under \Policies) would only be needed if the relevant group policy setting is configured. 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 will be rewritten at next Group Policy refresh if it's configured in Group Policy.
5153

52-
## Manage Windows Services using CMD
54+
## Use CMD to manage Windows services
5355

54-
### View service state
56+
To manage Windows services by usign CMD< follow these steps:
57+
58+
1. View the service state:
5559

5660
`sc query termservice`
5761

58-
### View service logon account
62+
1. View the service logon account:
5963

6064
`sc qc termservice`
6165

62-
### Set service logon account
66+
1. Set the service logon account:
6367

6468
`sc config termservice obj= "NT Authority\NetworkService"`
6569

66-
A space is required after the equals sign.
70+
**Note:** A space is required after the equal sign.
6771

68-
### Set service start type
72+
1. Set service start type:
6973

7074
`sc config termservice start= demand`
7175

72-
A space is required after the equals sign. Possible start values include `boot`, `system`, `auto`, `demand`, `disabled`, `delayed-auto`.
76+
**Note:** A space is required after the equal sign. Possible start values include: `boot`, `system`, `auto`, `demand`, `disabled`, and `delayed-auto`.
7377

74-
### Set service dependencies
78+
1. Set service dependencies:
7579

7680
`sc config termservice depend= RPCSS`
7781

78-
A space is required after the equals sign.
82+
**Note:** A space is required after the equal sign.
7983

80-
### Start service
84+
1. Start service by running either of the following commands:
8185

8286
`net start termservice`
8387

84-
or
85-
8688
`sc start termservice`
8789

88-
### Stop service
90+
1. Stop the service by running either of the following commands:
8991

9092
`net stop termservice`
9193

92-
or
93-
9494
`sc stop termservice`
9595

96-
## Manage Networking Features using CMD
96+
## Use CMD to manage networking features
9797

98-
### Show NIC properties
98+
Use manage networking features by using CMD, follow these steps:
9999

100-
`netsh interface show interface`
100+
1. Show the network shell (netsh) properties:
101101

102-
### Show IP properties
102+
> `netsh interface show interface`
103+
104+
1. Show IP properties:
103105

104-
`netsh interface ip show config`
106+
> `netsh interface ip show config`
105107
106-
### Show IPSec configuration
108+
1. Show IPSec configuration:
107109

108110
`netsh nap client show configuration`
109111

110-
### Enable NIC
112+
1. Enable the network shell interface:
111113

112114
`netsh interface set interface name="<interface name>" admin=enabled`
113115

114-
### Set NIC to use DHCP
116+
1. Set the netsh interface to use DHCP:
115117

116118
`netsh interface ip set address name="<interface name>" source=dhcp`
117119

118-
For more information about `netsh`, [click here](/windows-server/networking/technologies/netsh/netsh-contexts).
120+
For more information about `netsh`, see [Network shell (netsh)](/windows-server/networking/technologies/netsh/netsh-contexts).
119121

120-
Azure VMs should always be configured in the guest OS to use DHCP to obtain an IP address. The Azure static IP setting still uses DHCP to give the static IP to the VM.
122+
Azure VMs should always be configured in the Guest OS to use DHCP to get an IP address. The Azure static IP setting still uses DHCP to give the static IP to the VM.
121123

122124
### Ping
123125

0 commit comments

Comments
 (0)