Questions tagged [get-wmiobject]

Get-WmiObject is a powershell cmdlet that allows WML queries to be run against WMI objects on the local or remote computers.

190 questions
140
votes
6 answers

How to list all properties of a PowerShell WMI object

When I look at the Win32_ComputerSystem class, it shows loads of properties like Status, PowerManagementCapabilities, etc. However, when in PowerShell I do the below I only get back a couple: PS C:\Windows\System32\drivers> Get-WmiObject -Class…
lara400
  • 4,646
  • 13
  • 46
  • 66
25
votes
1 answer

What do Get-WMIObject \ Get-CimInstance actually do?

I have developing a new WMI instance provider and I am having a bit of trouble. I am able to register my provider successfully using regsvr32.exe. The regsvr32 application calls my implementation of DllRegisterServer and creates the following…
Code Doggo
  • 2,146
  • 6
  • 33
  • 58
8
votes
2 answers

How do I write the value of a single property of a object?

This is how my current script looks like: $cpu = Get-WmiObject win32_processor | select LoadPercentage logwrite $cpu #this fuction writes $cpu into a .txt file The output of the file is: @{LoadPercentage=4} I want it to be only the number so that…
verfluecht
  • 493
  • 6
  • 24
6
votes
1 answer

How can I use Get-WmiObject to filter on a processes "command line"

Is there a way to specify the -Filter parameter, using the WMI Query Language (WQL), of the Get-WmiObject cmdlet to filter based on the “Command Line” used to invoke the process? By “Command Line” I mean the “Command Line” that is shown in the…
paulhr
  • 339
  • 4
  • 17
4
votes
1 answer

Why does Get-WmiObject fail when run remotely via Invoke-Command?

I'm attempting to build a simple "get-ProcessInfo.ps1" module to be used with a PowerShell (forensics/IR) framework called Kansa. The command is a simple one liner that calls Get-WMIObject win32_process and pipes it into Select-Object. Then Kansa…
Duck
  • 91
  • 7
3
votes
1 answer

unable to authenticate credentials on remote windows to get drive details

Below is the PowerShell check_disk_space.ps1 is used to get remote Windows server drives information but instead I get an error: param ( [string]$passdrives, [string]$connuser, [string]$connpass, …
Ashar
  • 2,942
  • 10
  • 58
  • 122
3
votes
1 answer

Error calling get-wmiobject for Win32_powerplan

I'm trying to return the Win32_PowerPlan in PowerShell 7 on Windows 11 with the following code: get-wmiobject -namespace "root\cimv2\power" -class Win32_powerplan However, I get the output: get-wmiobject : At line:1 char:1 + get-wmiobject…
KyleMit
  • 30,350
  • 66
  • 462
  • 664
3
votes
1 answer

How to change an output formed by hashstables Powershell

I am storing the following query value in a variable: $unquotedPaths = Get-WmiObject -Class Win32_Service | Select-Object -Property Name,DisplayName,PathName,StartMode | Select-String "auto" The problem starts when i print that variable becouse the…
Estiwer
  • 163
  • 1
  • 7
3
votes
1 answer

Concatenate string to integer inside of Get-WmiObject table - PowerShell

I want to add "GB" to each instance of "Size" so each output shows "8GB". I'm not sure how to add or concatenate a string to the integer within the table... I have tried simply adding +"GB", assigning "GB" to a variable then adding + $GB. But get…
Boogershut
  • 43
  • 4
3
votes
1 answer

Windows PowerShell Command To List Group Members - Fine-Tuning

I've crafted the command below which listed out the members of a group: gwmi win32_group -filter 'Name="Administrators"'|%{$_.GetRelated('Win32_UserAccount')} | select Name The command above works, however, it takes ages to complete, is there a way…
Help
  • 161
  • 1
  • 2
  • 14
3
votes
2 answers

Single connection for multiple Get-WmiObject calls

The script below successfully obtains the manufacturer, model, serial number, and operating system from each computer I provide in hostnames.txt. However, it is slow because it must connect to WMI on each computer three times. $OS = Get-WmiObject…
Steven
  • 13,501
  • 27
  • 102
  • 146
2
votes
2 answers

Combine `Get-Disk` info and `LogicalDisk` info in PowerShell (but with formatted output)

This is a question about an answer for this Combine `Get-Disk` info and `LogicalDisk` info in PowerShell? Here is the answer which I've tried to change to get the output formatted how I want it: https://stackoverflow.com/a/31092004/8262102 It needs…
Ste
  • 1,729
  • 1
  • 17
  • 27
2
votes
3 answers

Write to external array inside a running powershell job

I am trying to write data to external array while running a powershell job- This is my code sample that I' m trying- $datafromJob = @() $wmijobs = @() foreach ($c in $computers) { $wmijobs += Start-Job -Name WMIInventory -ScriptBlock { …
2
votes
2 answers

How to check the start type of a windows service is "auto" or "auto-delayed" using Powershell 5 in windows server 2012

During maintenance, before I stop a Windows service, I need set its start type to Manual. Later I need switch it back to its original start type. So I need know the start type before I stop a service. In Windows 10, I know there is a property…
Jim
  • 769
  • 3
  • 10
  • 22
2
votes
1 answer

Why does Invoke-Command not work on some systems?

I have seen this question asked a lot, but most of the answers boil down to 4 things: be sure you have run enable-PSRemoting -force on remote system be sure WMI services are running on remote system. be sure you have Firewall rules allowing 5985…
cmwoodman
  • 65
  • 7
1
2 3
12 13