Cmdlets Network And System Management
Note: Must run as administrator.
### Adding a New Local User
New-LocalUser -Name "NewUser" -Password (Read-Host -AsSecureString "Enter password")
* * *
## IV. System Settings Operations
### Setting System Timezone
Set-TimeZone -Id "China Standard Time"
View supported timezones:
Get-TimeZone -ListAvailable
### Setting System Hostname (Requires Restart to Take Effect)
Rename-Computer -NewName "MyNewPC" -Restart
### Setting System Time (Requires Administrator Privileges)
Set-Date -Date "2025-07-22 10:30"
* * *
## V. Practical Scenario Examples
* * *
### Example 1: Testing Connectivity from Local Machine to Multiple Target Hosts
"192.168.1.1", "8.8.8.8", "www.baidu.com" | ForEach-Object { Test-Connection -ComputerName $_ -Count 2}
### Example 2: Listing Currently Open TCP Ports (Status: Listening)
Get-NetTCPConnection | Where-Object { $_.State -eq "Listen" }
### Example 3: Generating a System Information Report
$report = Get-ComputerInfo | Select-Object OSName, OSArchitecture, CsName, CsProcessors, WindowsVersion $report | Out-File -FilePath "C:SystemReport.txt"
* * *
## VI. Summary
PowerShell offers robust network and system management capabilities that far surpass traditional command-line tools:
* Network operations support testing, monitoring, and configuring IPs and ports
* System information commands facilitate generating diagnostic reports and automated audits
* Local account management is suitable for small systems or workgroups
* All commands are object-oriented, highly flexible, and scriptable
YouTip