使用Get-ItemProperty 命令可以获取指定注册表路径下的键值信息。 powershellCopy Code # 获取注册表项的值 Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShellState" 2. 设置注册表项的值 使用Set-ItemProperty
CsCurrentTimeZone 当前时区 计算机所在的时区信息。 CsDaylightInEffect 夏令时是否生效 系统是否正在使用夏令时。 CsDescription 计算机描述 对计算机系统的简短描述。 CsDNSHostName DNS 主机名 系统的 DNS 主机名,通常是网络中的唯一标识符。 CsDomain 域名 系统所属的域名。 CsDomainRole 域角色 系统在域中的角色...
$newServer = 'Server01.Domain01.Fabrikam.com' $curValue = (Get-Item wsman:\localhost\Client\TrustedHosts).Value Set-Item wsman:\localhost\Client\TrustedHosts -Value "$curValue, $newServer" 若要將特定電腦的IP位址新增至受信任的主機清單,請使用下列命令格式: PowerShell 複製 Set-Item...
$pc=New-Object System.DirectoryServices.AccountManagement.PrincipalContext($ct,$ctxDomain,$ctxContainer)return$pc}functionGet-Principal([string]$userName,[string]$userPassword,[string]$ctxDomain,[string]$ctxContainer){Add-Type-AssemblyName System.DirectoryServices.AccountManagement $ct=[System.DirectoryServices...
使用PowerShellGet cmdlet 是首选安装方法。 仅为当前用户安装 Az 模块。 这是建议的安装范围。 此方法在 Windows、Linux 和 macOS 平台上的工作方式相同。 从 PowerShell 会话运行以下命令: PowerShell if(Get-Module-NameAzureRM-ListAvailable) {Write-Warning-Message('Az module not installed. Having both the...
Get-WinEvent 参考 模块: Microsoft.PowerShell.Diagnostics 获取本地和远程计算机上的事件日志和事件跟踪日志文件中的事件。 语法 PowerShell复制 Get-WinEvent[[-LogName] <String[]>] [-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXPath <String>] [-Force] [-Oldes...
指定要用于交互式会话的 PowerShell 会话(PSSession)。 此参数采用会话对象。 还可以使用Name、InstanceId或Id参数来指定PSSession。 输入包含会话对象的变量或创建或获取会话对象的命令,例如New-PSSession或Get-PSSession命令。 还可以通过管道将会话对象传递给Enter-PSSession。 只能使用此参数提交一个PSSession。 如果输入...
Get-Acl 参考 反馈 模块: Microsoft.PowerShell.Security 获取资源(如文件或注册表项)的安全描述符。 语法 PowerShell Get-Acl[[-Path] <String[]>] [-Audit] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>] [<CommonParameters>] ...
Get-WmiObject -class Win32_Bios -computername $machine -namespace $namespace | Select-Object -ExpandProperty SerialNumber $obj.Manufacturer = Get-WmiObject -class Win32_Bios -computername $machine -namespace $namespace | Select-Object -ExpandProperty Manufacturer $obj.UUID = Get-WmiObject W...
Get-CimClass[[-ClassName] <string>] [[-Namespace] <string>] [-Amended] [-OperationTimeoutSec <uint>] [-ComputerName <string[]>] [-MethodName <string>] [-PropertyName <string>] [-QualifierName <string>] [<CommonParameters>]