Skip to content

Commit 84827f4

Browse files
authored
Fix typos and improve clarity in PowerShell commands
1 parent 441675a commit 84827f4

1 file changed

Lines changed: 44 additions & 44 deletions

File tree

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

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,89 +33,89 @@ Because of SAC's limited screen buffer, it might be easier to manage longer comm
3333

3434
## Use CMD for Windows registry settings
3535

36-
To view and edit Windows registry settings by using CMD, follow these steps:
36+
To view and edit Windows registry settings by using CMD, follow these steps:
3737

38-
1. Verify that RDP is enabled by running the following commands:
38+
1. Verify that RDP is enabled. Run the following commands:
3939

40-
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
40+
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
4141

42-
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections
42+
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections
4343

44-
**Note:** The second key (under \Policies) exists only if the relevant Group Policy setting is configured.
44+
**Note:** The second key (under \Policies) exists only if the relevant Group Policy setting is configured.
4545

4646
1. Enable RDP by running the following commands:
4747

48-
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
4949

50-
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
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 will be rewritten at next Group Policy refresh if it's configured in Group Policy.
5353

5454
## Use CMD to manage Windows services
5555

5656
To manage Windows services by using CMD, follow these steps:
5757

5858
1. View the service state:
5959

60-
`sc query termservice`
60+
`sc query termservice`
6161

6262
1. View the service logon account:
6363

64-
`sc qc termservice`
64+
`sc qc termservice`
6565

6666
1. Set the service logon account:
6767

68-
`sc config termservice obj= "NT Authority\NetworkService"`
68+
`sc config termservice obj= "NT Authority\NetworkService"`
6969

70-
**Note:** A space is required after the equal sign.
70+
**Note:** A space is required after the equal sign.
7171

7272
1. Set service start type:
7373

74-
`sc config termservice start= demand`
74+
`sc config termservice start= demand`
7575

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

7878
1. Set service dependencies:
7979

80-
`sc config termservice depend= RPCSS`
80+
`sc config termservice depend= RPCSS`
8181

82-
**Note:** A space is required after the equal sign.
82+
**Note:** A space is required after the equal sign.
8383

8484
1. Start service by running either of the following commands:
8585

86-
`net start termservice`
86+
`net start termservice`
8787

88-
`sc start termservice`
88+
`sc start termservice`
8989

9090
1. Stop the service by running either of the following commands:
9191

92-
`net stop termservice`
92+
`net stop termservice`
9393

94-
`sc stop termservice`
94+
`sc stop termservice`
9595

9696
## Use CMD to manage networking features
9797

9898
To manage networking features using CMD, follow these steps:
99-
99+
100100
1. Show the network shell (netsh) properties:
101101

102-
`netsh interface show interface`
102+
`netsh interface show interface`
103103

104104
1. Show IP properties:
105105

106-
`netsh interface ip show config`
106+
`netsh interface ip show config`
107107

108108
1. Show IPSec configuration:
109109

110-
`netsh nap client show configuration`
110+
`netsh nap client show configuration`
111111

112112
1. Enable the network shell interface:
113113

114-
`netsh interface set interface name="<interface name>" admin=enabled`
114+
`netsh interface set interface name="<interface name>" admin=enabled`
115115

116116
1. Set the netsh interface to use DHCP:
117117

118-
`netsh interface ip set address name="<interface name>" source=dhcp`
118+
`netsh interface ip set address name="<interface name>" source=dhcp`
119119

120120
For more information about `netsh`, see [Network shell (netsh)](/windows-server/networking/technologies/netsh/netsh-contexts).
121121

@@ -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 only be needed 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 had been configured. Value will be rewritten at next group policy refresh if it's configured in group policy.
387387

388388
## Manage Windows Services using PowerShell
389389

@@ -427,52 +427,52 @@ or
427427

428428
`get-wmiobject win32_networkadapter -filter "servicename='netvsc'" | format-list netenabled,name,macaddress`
429429

430-
`Get-NetAdapter` is available in 2012+, for 2008R2 use `Get-WmiObject`.
430+
`Get-NetAdapter` is available in 2012 and later versions, for 2008 R2, use `Get-WmiObject`.
431431

432432
### Show IP properties
433433

434434
`get-wmiobject Win32_NetworkAdapterConfiguration -filter "ServiceName='netvsc'" | format-list DNSHostName,IPAddress,DHCPEnabled,IPSubnet,DefaultIPGateway,MACAddress,DHCPServer,DNSServerSearchOrder`
435435

436-
### Enable NIC
436+
### Enable network adapter
437437

438438
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | enable-netadapter`
439439

440440
or
441441

442442
`(get-wmiobject win32_networkadapter -filter "servicename='netvsc'").enable()`
443443

444-
`Get-NetAdapter` is available in 2012+, for 2008R2 use `Get-WmiObject`.
444+
`Get-NetAdapter` is available in 2012 and later versions, for 2008 R2, use `Get-WmiObject`.
445445

446-
### Set NIC to use DHCP
446+
### Set network adapter to use DHCP
447447

448448
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | Set-NetIPInterface -DHCP Enabled`
449449

450450
`(get-wmiobject Win32_NetworkAdapterConfiguration -filter "ServiceName='netvsc'").EnableDHCP()`
451451

452-
`Get-NetAdapter` is available on 2012+. For 2008R2 use `Get-WmiObject`. 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 IP to the VM.
452+
`Get-NetAdapter` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`. 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 IP to the VM.
453453

454454
### Ping
455455

456456
`test-netconnection`
457457

458458
> [!NOTE]
459-
> 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.
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.
460460
461461
or
462462

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

465-
`Test-Netconnection` without any parameters try to ping `internetbeacon.msedge.net`. It's available on 2012+. For 2008R2 use `Get-WmiObject` as in the second example.
465+
`Test-Netconnection` without any parameters, try to ping `internetbeacon.msedge.net`. It's available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`, as in the second example.
466466

467-
### Port Ping
467+
### Port ping
468468

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

471471
or
472472

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

475-
`Test-NetConnection` is available on 2012+. For 2008R2 use `Net.Sockets.TcpClient`
475+
`Test-NetConnection` is available in 2012 and later versions. For 2008 R2, use `Net.Sockets.TcpClient`.
476476

477477
### Test DNS name resolution
478478

@@ -482,7 +482,7 @@ or
482482

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

485-
`Resolve-DnsName` is available on 2012+. For 2008R2 use `System.Net.DNS`.
485+
`Resolve-DnsName` is available in 2012 and later versions. For 2008 R2, use `System.Net.DNS`.
486486

487487
### Show Windows Firewall rule by name
488488

@@ -496,13 +496,13 @@ or
496496

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

499-
`Get-NetFirewallPortFilter` is available on 2012+. For 2008R2 use the `hnetcfg.fwpolicy2` COM object.
499+
`Get-NetFirewallPortFilter` is available in 2012 and later versions. For 2008 R2, use the `hnetcfg.fwpolicy2` COM object.
500500

501501
### Disable Windows Firewall
502502

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

505-
`Set-NetFirewallProfile` is available on 2012+. For 2008R2 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 above.
506506

507507
## Manage Users and Groups using PowerShell
508508

@@ -518,7 +518,7 @@ or
518518

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

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

523523
### Add local user to local group
524524

@@ -538,13 +538,13 @@ 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 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`.
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`.
542542

543543
### View local groups
544544

545545
`(get-localgroup).name | sort` `(get-wmiobject win32_group).Name | sort`
546546

547-
`Get-LocalUser` is available on 2012+. For 2008R2 use `Get-WmiObject`.
547+
`Get-LocalUser` is available in 2012 and later versions. For 2008 R2, use `Get-WmiObject`.
548548

549549
## Manage the Windows Event Log using PowerShell
550550

@@ -596,7 +596,7 @@ This example returns the file version of the virtual NIC driver, which is named
596596

597597
This example creates a `c:\bin` folder, then downloads and extracts the Sysinternals suite of tools into `c:\bin`.
598598

599-
## Miscellaneous Tasks using PowerShell
599+
## Miscellaneous tasks that use PowerShell
600600

601601
### Show OS version
602602

@@ -626,7 +626,7 @@ Adding `-force` forces running applications to close without warning users.
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. So if you're able to query instance metadata that tells you the guest is able to 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're able to query instance metadata, that means that 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)