要获得带有WMI对象的正在运行的进程,您需要使用Win32_Process类。使用此方法,您将获得比Get-Process命令更多的属性。 命令 Get-WmiObject –Class Win32_Process 输出结果 GENUS : 2 __CLASS : Win32_Process __SUPERCLASS : CIM_Process __DYNASTY : CIM_ManagedSystemElement __RELPATH : Win32_Process....
示例:Get-WmiObject -Class Win32_Process -Filter "Name='explorer.exe'",仅返回名称为 "explorer.exe" 的进程。 3.2 获取指定属性 使用Select-Object命令选择要显示的属性。 示例:Get-WmiObject -Class Win32_Process | Select-Object ProcessId, Name, CommandLine,选择显示进程的 ID、名称和命令行。 3.3 远...
1.命令:get-wmiobject Win32_DiskDrive 查看网卡信息 1.命令: Get-WmiObject -Class win32_networkadapter | format-table -Property name, interfaceIndex, ` adapterType, macAddress –autosize 查看进程 1.命令:Get-Process
Get-WmiObject-ClassWin32_Process 示例2:获取远程计算机上的服务 此示例获取远程计算机上的服务。ComputerName参数指定远程计算机的 IP 地址。 默认情况下,当前用户帐户必须是远程计算机上 Administrators 组的成员。 PowerShell Get-WmiObject-ClassWin32_Service-ComputerName10.1.4.62 ...
这个操作不需要远程服务器上安装PowerShell。运行时指定-credential参数了么?不指定就用当前身份执行,需要这个当前身份有权限访问远程计算机。可以预先指定,也可以在运行代码的时候指定,比如 get-wmiobject win32_process -computername pcname -credential $cre 跳出密码验证提示后,输入有权限访问远程计算机...
System Idle Process上例使用PSBase属性获取原始的未经适配器处理的对象,通过适配器只需要如下简单代码:展开表 PS C:\> (Get-WmiObject win32_process)[0].Caption System Idle Process(2)DirectoryEntryAdapter这个适配器和Windows活动目录配合工作,工作方式与ManagementObjectAdapter相似。(...
格式1:Get-WmiObject -Class [类名] | select [字段名] Get-WmiObject-ClassWin32_Product|selectname//获取软件列表Get-WmiObjectWin32_QuickFixEngineering//获取系统已安装更新列表,可以不带-Class//获取Windows激活信息Get-WmiObjectSoftwareLicensingProduct-filter'PartialProductKey != NULL and ApplicationID="55c...
其中ROOTCIMV2是一个默认的命名空间, 类Win32_OperatingSystem是获取机器的信息, 这里对应到我们的wmic.exe的命令就是wmic /NAMESPACE:"rootCIMV2" PATH Win32_OperatingSystem, 那么还有很多类可以调用,比如:Get-WmiObject -Class Win32_Process,这条命令会获取到所有的本地计算机的进程,我们选择一个进程来查看Get...
Get-WmiObject-Namespace"root\cimv2"-ClassWin32_Process-Impersonation3-ComputerNameComputer_B 在上述範例中,使用者會使用相同的認證連線到遠端電腦, (網域和使用者名稱) 登入。 使用者也要求使用模擬。 不同于原始 VBScript 範例,不需要 Moniker 字串,因為模擬層級是由 「Impersonation」 屬性所設定...
$Computer="atl-dc-01"Get-WmiObject-Namespace"root\cimv2"-ClassWin32_Process-Impersonation3-Credential` FABRIKAM\administrator-ComputerName$Computer 在前面的示例中,计算机名称已分配给 $Computer 变量。 用户通过使用特定凭据(域和用户名)连接到远程计算机,并请求模拟身份验证级别。