为以后自动化运维管理,现在开始学习下Windows PowerShell。
基本常用命令:
1、查看计算机或服务器基本信息:
PS C:\Users\czy> Get-WmiObject -Class win32_computersystem
Domain : WORKGROUP
Manufacturer : LENOVO
Model : 235926C
Name : CZY-PC
PrimaryOwnerName : czy
TotalPhysicalMemory : 8370892800
2、查看计算机或服务器BIOS基本信息:
PS C:\Users\czy> Get-WmiObject -class win32_bios -ComputerName.
SMBIOSBIOSVersion : G4ET37WW (1.12 )
Manufacturer : LENOVO
Name : Phoenix BIOS SC-T v2.2
SerialNumber : R9RMHKN
Version : LENOVO - 1120
3、查看当前计算机或服务器的用户的用户名:
PS C:\Users\czy> Get-WmiObject -Class win32_computersystem -Property username -ComputerName.
__GENUS : 2
__CLASS : Win32_ComputerSystem
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
UserName : CZY-PC\czy
PSComputerName :
4、查看当前计算机或服务器所安装的应用程序名称:
PS C:\Users\czy> Get-WmiObject -Class win32_product -ComputerName. | format-wide -column 1 //-column 1 为显示一列模式//
Lenovo Patch Utility
Lenovo Patch Utility 64 bit
Microsoft DCF MUI (Chinese (Simplified)) 2013
Microsoft Office Professional Plus 2013
Microsoft OneNote MUI (Chinese (Simplified)) 2013
Microsoft Office 32-bit Components 2013
Microsoft Office Shared 32-bit MUI (Chinese (Simplified)) 2013
Microsoft Office OSM MUI (Chinese (Simplified)) 2013
Microsoft Office OSM UX MUI (Chinese (Simplified)) 2013
Microsoft InfoPath MUI (Chinese (Simplified)) 2013
Microsoft Access MUI (Chinese (Simplified)) 2013
Microsoft Excel MUI (Chinese (Simplified)) 2013
Microsoft PowerPoint MUI (Chinese (Simplified)) 2013
Microsoft Publisher MUI (Chinese (Simplified)) 2013
Microsoft Outlook MUI (Chinese (Simplified)) 2013
Microsoft Groove MUI (Chinese (Simplified)) 2013
Microsoft Word MUI (Chinese (Simplified)) 2013
Microsoft Lync MUI (Chinese (Simplified)) 2013
Microsoft Office Proofing (Chinese (Simplified)) 2013
Microsoft Office Shared MUI (Chinese (Simplified)) 2013
Microsoft Office 校对工具 2013 - 简体中文
Microsoft Office Proofing Tools 2013 - English
Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.4148
Microsoft Visual C++ 2010 x64 Redistributable - 10.0.40219
Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219
Xmanager Enterprise 4
ArcGIS 10.2 for Desktop
Adobe Reader XI (11.0.01)
腾讯QQ2013
Dolby Advanced Audio v2
Microsoft Visual C++ 2005 Redistributable
VMware vSphere Client 5.1
Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148
Microsoft Visual J# 2.0 Redistributable Package - SE (x64)
5、查看当前计算机或服务器的IP地址信息[IP地址信息用xx代替]:
PS C:\Users\czy> Get-WmiObject -Class win32_networkadapterconfiguration -Filter ipenabled=true -ComputerName. | Format-T
able -Property IPaddress
IPaddress
---------
{xx.xx.247.115, fe80::dced:821f:623:6ee3}
6、查看当前计算机或服务器的IP配置详细信息:
PS C:\Users\czy> Get-WmiObject -Class win32_networkadapterconfiguration -Filter ipenabled=true -ComputerName. | Select-O
bject -Property [a-z]* -ExcludeProperty IPX*,WINS*
PSComputerName : CZY-PC
DHCPLeaseExpires :
Index : 11
Description : Intel(R) 82579LM Gigabit Network Connection
DHCPEnabled : False
DHCPLeaseObtained :
DHCPServer :
DNSDomain :
DNSDomainSuffixSearchOrder : {}
DNSEnabledForWINSResolution : False
DNSHostName : CZY-PC
DNSServerSearchOrder : {xx.xx.xx.66, xx.xx.xx.67}
DomainDNSRegistrationEnabled : False
FullDNSRegistrationEnabled : True
IPAddress : {xx.xx.xx.115, fe80::dced:821f:623:6ee3}
IPConnectionMetric : 10
IPEnabled : True
IPFilterSecurityEnabled : False
ArpAlwaysSourceRoute :
ArpUseEtherSNAP :
Caption : [00000011] Intel(R) 82579LM Gigabit Network Connection
DatabasePath : %SystemRoot%\System32\drivers\etc
DeadGWDetectEnabled :
DefaultIPGateway : {xx.xx.xx.251}
DefaultTOS :
DefaultTTL : 64
ForwardBufferMemory :
GatewayCostMetric : {256}
IGMPLevel :
InterfaceIndex : 13
IPPortSecurityEnabled :
IPSecPermitIPProtocols : {}
IPSecPermitTCPPorts : {}
IPSecPermitUDPPorts : {}
IPSubnet : {255.255.255.0, 64}
IPUseZeroBroadcast :
KeepAliveInterval :
KeepAliveTime :
MACAddress : 3C:97:0E:1D:34:CC
MTU :
NumForwardPackets :
PMTUBHDetectEnabled : True
PMTUDiscoveryEnabled : True
ServiceName : e1cexpress
SettingID : {B145E9E4-8B8A-494F-A1DF-DAC814E1F134}
TcpipNetbiosOptions : 0
TcpMaxConnectRetransmissions :
TcpMaxDataRetransmissions :
TcpNumConnections :
TcpUseRFC1122UrgentPointer :
TcpWindowSize :
Scope : System.Management.ManagementScope
Path : \\xxx-PC\root\cimv2:Win32_NetworkAdapterConfiguration.Index=11
Options : System.Management.ObjectGetOptions
ClassPath : \\xxx-PC\root\cimv2:Win32_NetworkAdapterConfiguration
Properties : {ArpAlwaysSourceRoute, ArpUseEtherSNAP, Caption, DatabasePath...}
SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers : {dynamic, Locale, provider, UUID}
Site :
Container :