Skip to content

Commit 1ee0a36

Browse files
authored
Update serial-console-cmd-ps-commands.md
1 parent 4f0cf43 commit 1ee0a36

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This article provides example commands to perform common tasks in scenarios in w
2323

2424
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 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.
2727

2828
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

@@ -49,7 +49,7 @@ To view and edit Windows registry settings by using CMD, follow these steps:
4949

5050
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections /t REG_DWORD /d 0
5151

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.
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.
5353

5454
## Use CMD to manage Windows services
5555

@@ -153,7 +153,7 @@ When limited to methods available in Windows by default, PowerShell can be a bet
153153

154154
`netsh advfirewall set allprofiles state off`
155155

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.
157157

158158
### Enable Windows Firewall
159159

@@ -173,7 +173,7 @@ You can use this command when troubleshooting to temporarily rule out the Window
173173

174174
`net user <username> | find /i "active"`
175175

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`.
177177

178178
### Enable user account
179179

@@ -229,7 +229,7 @@ Use `604800000` to look back seven days instead of 24 hours.
229229

230230
`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`
231231

232-
## View or Remove Installed Applications using CMD
232+
## View or remove installed applications by using CMD
233233

234234
### List installed applications
235235

@@ -241,15 +241,15 @@ The `sort /r` command sorts results in descending order by install date, making
241241

242242
`wmic path win32_product where name="<name>" call uninstall`
243243

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.
245245

246246
## File System Management using CMD
247247

248248
### Get file version
249249

250250
`wmic datafile where "drive='C:' and path='\\windows\\system32\\drivers\\' and filename like 'netvsc%'" get version /format:list`
251251

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.
253253

254254
### Scan for system file corruption
255255

@@ -288,9 +288,9 @@ When using `/restore`, specify the parent folder of the one used in
288288

289289
## Manage Devices
290290

291-
### Remove non-present PNP devices
291+
### Remove entries for nonexistent PNP devices
292292

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:
294294

295295
`%windir%\System32\RUNDLL32.exe %windir%\System32\pnpclean.dll,RunDLL_PnpClean /Devices /Maxclean`
296296

@@ -361,13 +361,13 @@ If this command returns to a prompt with no output, then the module wasn't loade
361361

362362
`get-module psreadline`
363363

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.
365365

366366
`remove-module psreadline`
367367

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`.
369369

370-
## View and Edit Windows Registry Settings using PowerShell
370+
## View and Edit Windows Registry Settings by using PowerShell
371371

372372
### Verify RDP is enabled
373373

@@ -383,7 +383,7 @@ The second key under `\Policies` exists only if the relevant Group Policy settin
383383

384384
`set-itemproperty -path 'hklm:\software\policies\microsoft\windows nt\terminal services' -name 'fdenytsconNections' 0 -type dword`
385385

386-
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.
387387

388388
## Manage Windows Services using PowerShell
389389

@@ -419,7 +419,7 @@ When using a service account other than `NT AUTHORITY\LocalService`, `NT AUTHORI
419419

420420
## Manage Networking Features using PowerShell
421421

422-
### Show NIC properties
422+
### Show network adapter properties
423423

424424
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | format-list status,name,ifdesc,macadDresS,driverversion,MediaConNectState,MediaDuplexState`
425425

@@ -458,7 +458,7 @@ or
458458
> [!NOTE]
459459
> 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.
460460
461-
or
461+
Or
462462

463463
`get-wmiobject Win32_PingStatus -Filter 'Address="8.8.8.8"' | format-table -autosize IPV4Address,ReplySize,ResponseTime`
464464

@@ -468,7 +468,7 @@ or
468468

469469
`test-netconnection -ComputerName bing.com -Port 80`
470470

471-
or
471+
Or
472472

473473
`(new-object Net.Sockets.TcpClient).BeginConnect('bing.com','80',$null,$null).AsyncWaitHandle.WaitOne(300)`
474474

@@ -478,7 +478,7 @@ or
478478

479479
`resolve-dnsname bing.com`
480480

481-
or
481+
Or
482482

483483
`[System.Net.Dns]::GetHostAddresses('bing.com')`
484484

@@ -492,7 +492,7 @@ or
492492

493493
`get-netfirewallportfilter | where {$_.localport -eq 3389} | foreach {Get-NetFirewallRule -Name $_.InstanceId} | format-list Name,Enabled,Profile,Direction,Action`
494494

495-
or
495+
Or
496496

497497
`(new-object -ComObject hnetcfg.fwpolicy2).rules | where {$_.localports -eq 3389 -and $_.direction -eq 1} | format-table Name,Enabled`
498498

@@ -502,7 +502,7 @@ or
502502

503503
`Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False`
504504

505-
`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.
506506

507507
## Manage Users and Groups using PowerShell
508508

@@ -514,11 +514,11 @@ or
514514

515515
`(get-localuser | where {$_.SID -like "S-1-5-21-*-500"}).Enabled`
516516

517-
or
517+
Or
518518

519519
`(get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'").Disabled`
520520

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`.
522522

523523
### Add local user to local group
524524

@@ -528,17 +528,17 @@ or
528528

529529
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
530530

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`.
532532

533533
### View user account properties
534534

535535
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | format-list *`
536536

537-
or
537+
Or
538538

539539
`get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'" | format-list Name,Disabled,Status,Lockout,Description,SID`
540540

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, 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`.
542542

543543
### View local groups
544544

@@ -572,7 +572,7 @@ Use `604800000` to look back seven days instead of 24 hours. |
572572

573573
`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`
574574

575-
## View or Remove Installed Applications using PowerShell
575+
## View or remove iInstalled applications by using PowerShell
576576

577577
### List installed software
578578

@@ -582,7 +582,7 @@ Use `604800000` to look back seven days instead of 24 hours. |
582582

583583
`(get-wmiobject win32_product -filter "Name='<name>'").Uninstall()`
584584

585-
## File System Management using PowerShell
585+
## File System Management by using PowerShell
586586

587587
### Get file version
588588

@@ -622,11 +622,11 @@ Returns uptime as `<days>:<hours>:<minutes>:<seconds>:<milliseconds>`, for examp
622622

623623
Adding `-force` forces running applications to close without warning users.
624624

625-
## Instance Metadata
625+
## Instance metadata
626626

627627
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.
628628

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.
630630

631631
For more information, see [Azure Instance Metadata service](/azure/virtual-machines/windows/instance-metadata-service).
632632

0 commit comments

Comments
 (0)