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/serial-console-cmd-ps-commands.md
+30-27Lines changed: 30 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ SAC has been included in all versions of Windows since Windows Server 2003 but i
25
25
26
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 are 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 do not support the ability to access WinRE, with the serial console feature, Azure VMs can be managed via SAC.
27
27
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 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.
29
29
30
30
`SHIFT+INSERT` is the paste shortcut for the serial console window.
31
31
@@ -42,7 +42,7 @@ The second key (under \Policies) will only exist if the relevant group policy se
The second key (under \Policies) would only be needed if the relevant group policy setting had been configured. Value will be rewritten at next group policy refresh if it is configured in group policy.
48
48
@@ -52,12 +52,12 @@ The second key (under \Policies) would only be needed if the relevant group poli
A space is required after the equals sign. Possible start values include `boot`, `system`, `auto`, `demand`, `disabled`, `delayed-auto`.
63
63
### Set service dependencies
@@ -78,11 +78,11 @@ or
78
78
`sc stop termservice`
79
79
## Manage Networking Features
80
80
### Show NIC properties
81
-
`netsh interface show interface`
81
+
`netsh interface show interface`
82
82
### Show IP properties
83
83
`netsh interface ip show config`
84
84
### Show IPSec configuration
85
-
`netsh nap client show configuration`
85
+
`netsh nap client show configuration`
86
86
### Enable NIC
87
87
`netsh interface set interface name="<interface name>" admin=enabled`
88
88
### Set NIC to use DHCP
@@ -92,8 +92,8 @@ For more information about `netsh`, [click here](https://docs.microsoft.com/wind
92
92
93
93
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.
@@ -127,7 +127,7 @@ You can use this command when troubleshooting to temporarily rule out the Window
127
127
128
128
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`.
129
129
### Enable user account
130
-
`net user <username> /active:yes`
130
+
`net user <username> /active:yes`
131
131
### View user account properties
132
132
`net user <username>`
133
133
@@ -188,15 +188,15 @@ See also [Repair a Windows Image](https://docs.microsoft.com/windows-hardware/ma
The path when using `/restore` needs to be the parent folder of the folder you specified when using `/save`. In this example, `\RSA` is the parent of the `\MachineKeys` folder specified in the `/save` example above.
@@ -207,19 +207,19 @@ The path when using `/restore` needs to be the parent folder of the folder you s
207
207
### Show OS version
208
208
`ver`
209
209
210
-
or
210
+
or
211
211
212
212
`wmic os get caption,version,buildnumber /format:list`
213
213
214
-
or
214
+
or
215
215
216
216
`systeminfo find /i "os name"`
217
217
218
218
`systeminfo | findstr /i /r "os.*version.*build"`
219
219
### View OS install date
220
220
`systeminfo | find /i "original"`
221
221
222
-
or
222
+
or
223
223
224
224
`wmic os get installdate`
225
225
### View last boot time
@@ -235,7 +235,7 @@ or
235
235
236
236
Adding `/f` will force running applications to close without warning users.
237
237
### Detect Safe Mode boot
238
-
`bcdedit /enum | find /i "safeboot"`
238
+
`bcdedit /enum | find /i "safeboot"`
239
239
240
240
## Windows Commands - PowerShell
241
241
@@ -246,7 +246,7 @@ To run PowerShell in SAC, after you reach a CMD prompt, type:
246
246
> [!CAUTION]
247
247
> Remove the PSReadLine module from the PowerShell session before running any other PowerShell commands. There is a known issue where extra characters may be introduced in text pasted from the clipboard if PSReadLine is running in a PowerShell session in SAC.
248
248
249
-
First check if PSReadLine is loaded. It is loaded by default on Windows Server 2016, Windows 10, and later versions of Windows. It would only be present on earlier Windows versions if it had been manually installed.
249
+
First check if PSReadLine is loaded. It is loaded by default on Windows Server 2016, Windows 10, and later versions of Windows. It would only be present on earlier Windows versions if it had been manually installed.
250
250
251
251
If this command returns to a prompt with no output, then the module was not loaded and you can continue using the PowerShell session in SAC as normal.
252
252
@@ -292,7 +292,7 @@ When using a service account other than `NT AUTHORITY\LocalService`, `NT AUTHORI
292
292
### Show NIC properties
293
293
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | format-list status,name,ifdesc,macadDresS,driverversion,MediaConNectState,MediaDuplexState`
> The Write-Progress cmdlet may not work with this command. As a mitigation, you can run `$ProgressPreference = "SilentlyContinue"` in PowerShell to disable the progress bar.
`(get-localuser | where {$_.SID -like "S-1-5-21-*-500"}).Enabled`
359
362
360
-
or
363
+
or
361
364
362
365
`(get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'").Disabled`
363
366
364
367
`Get-LocalUser` is available on 2012+. For 2008R2 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`.
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
371
+
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
369
372
370
373
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`.
371
374
### View user account properties
372
375
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | format-list *`
Pressing **Enter** after the connection banner does not cause a sign-in prompt to be displayed. | For more information, see [Hitting enter does nothing](https://github.com/Microsoft/azserialconsole/blob/master/Known_Issues/Hitting_enter_does_nothing.md). This issue can occur if you're running a custom VM, hardened appliance, or GRUB config that causes Linux to fail to connect to the serial port.
124
+
Pressing **Enter** after the connection banner does not cause a sign-in prompt to be displayed. | GRUB may not be configured correctly. Run the following commands: `grub2-mkconfig -o /etc/grub2-efi.cfg` and/or `grub2-mkconfig -o /etc/grub2.cfg`. For more information, see [Hitting enter does nothing](https://github.com/Microsoft/azserialconsole/blob/master/Known_Issues/Hitting_enter_does_nothing.md). This issue can occur if you're running a custom VM, hardened appliance, or GRUB config that causes Linux to fail to connect to the serial port.
125
125
Serial console text only takes up a portion of the screen size (often after using a text editor). | Serial consoles do not support negotiating about window size ([RFC 1073](https://www.ietf.org/rfc/rfc1073.txt)), which means that there will be no SIGWINCH signal sent to update screen size and the VM will have no knowledge of your terminal's size. Install xterm or a similar utility to provide you with the `resize` command, and then run `resize`.
126
126
Pasting long strings doesn't work. | The serial console limits the length of strings pasted into the terminal to 2048 characters to prevent overloading the serial port bandwidth.
127
127
Erratic keyboard input in SLES BYOS images. Keyboard input is only sporadically recognized. | This is an issue with the Plymouth package. Plymouth should not be run in Azure as you don't need a splash screen and Plymouth interferes with the platform ability to use Serial Console. Remove Plymouth with `sudo zypper remove plymouth` and then reboot. Alternatively, modify the kernel line of your GRUB config by appending `plymouth.enable=0` to the end of the line. You can do this by [editing the boot entry at boot time](https://aka.ms/serialconsolegrub#single-user-mode-in-suse-sles), or by editing the GRUB_CMDLINE_LINUX line in `/etc/default/grub`, rebuilding GRUB with `grub2-mkconfig -o /boot/grub2/grub.cfg`, and then rebooting.
* To create a Red Hat Enterprise Linux VM from an Azure Marketplace PAYG image and to use Azure-hosted RHUI, go to the [Azure Marketplace](https://azure.microsoft.com/marketplace/partners/redhat/).
212
236
* To learn more about the Red Hat images in Azure, go to the [documentation page](./redhat-images.md).
0 commit comments