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
0
votes
1 answer

PowerShell to find computers in the domain, user is logged on

I am fairly new to PowerShell. I have this script working for computer names on the domain, thanks to @Adam Bertram https://4sysops.com/archives/how-to-find-a-logged-in-user-remotely-using-powershell/. I understand it and it works fine on my domain…
Traconis
  • 33
  • 1
  • 2
  • 6
0
votes
1 answer

Not able to change the Service StartMode

I am automating an application deployment. After installing and starting the service via Choco, I am trying to change the Service StartMode to Auto, but I am getting 21 as the returnvalue and hence the mode is not changed. PS C:\Windows\system32>…
sriramsm04
  • 343
  • 1
  • 7
  • 22
0
votes
1 answer

How to query for VM features using WMI class Msvm_SummaryInformation or Msvm_VirtualSystemManagementService in C++

This is code snippet from MSFT documentation https://learn.microsoft.com/en-us/windows/win32/wmisdk/example--getting-wmi-data-from-the-local-computer The example uses Win32_OperatingSystem and it works fine. I replaced Win32_OperatingSystem with…
Santhosh Kumar
  • 381
  • 1
  • 5
  • 13
0
votes
1 answer

Why do I get this error when trying to archive the Security event log?

$EventLog = Get-WmiObject Win32_NTEventlogFile -Filter "LogFileName = 'Security'" $Date = Get-Date -Format yyyyMMdd $Path =…
Moose
  • 1
0
votes
1 answer

How to export information about the monitor to a csv file using PowerShell?

I am new to PowerShell and am struggling to write a script to export the UserFriendlyName (see the code below) for three monitors. Here is what I have so far: $monitors = Get-WmiObject -Namespace root\wmi -Class wmiMonitorID Get-CimInstance…
0
votes
2 answers

How to return a single integer from this WMIObject in PowerShell (Temperature)

$temps = Get-CIMInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" $temps | Select-Object -Property InstanceName,@{n="TempF";e={(($_.currenttemperature /10 -273.15) *1.8 +32)}} I cannot seem to select-object -ExpandProperty like…
0
votes
1 answer

Uninstalling software (ArcFM) with powershell with no Remove option in MSI

Summary of situation I have some third party extension software for ArcGIS that I need to be able to uninstall with a powershell script. I have successfully installed and uninstalled a suite of software using the AppDeployToolkit for powershell but…
Riley Hughes
  • 1,344
  • 2
  • 12
  • 22
0
votes
1 answer

What are _Base properties in Powershell and how do I use them?

Take for instance the output of gwmi Win32_PerfRawData_PerfDisk_PhysicalDisk Among properties we find PercentDiskTime and PercentDiskTime_Base The documentation about this class at learn.microsoft.com makes no sense to me as it only states…
mfloris
  • 361
  • 4
  • 16
0
votes
1 answer

Powershell WMI Win32_LogicalDisk - Filtering on FreeSpace

I have a bigger script that sends emails when disk of various computer is under 20%. Now I have one computer that is under 20%, but has 40 GB, so I want to add a second filter to only send the email when the FreeSpace < 10 GB. I can't get the…
NealWalters
  • 17,197
  • 42
  • 141
  • 251
0
votes
0 answers

Specified cast not valid on ManagementObjectSearcher

When I run the code below in a virtual machine then I'm getting the following exception on the .Get() function: Specified cast is not valid For Each queryObj As ManagementObject In New ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard").Get() …
Gforse
  • 323
  • 3
  • 20
0
votes
1 answer

Powershell script to get IPv4 only

I'm trying to get IPv4 only from my computer which has multiple IPv4 addresses. The output contains IPv6 also as below: 10.24.21.115 fe80::8029:4127:55a6:4328 192.168.0.2 fe80::ac59:de9a:c9db:b5d8 Tried filtering like $_.ipaddress -notlike "fe80*"…
Justin D
  • 35
  • 11
0
votes
0 answers

Does not get expected result using Invoke-VMScript to query wmi disk

Good Day I'm trying to add information on the the disk path to the original script, below, which match VM and Windows harddisks. http://www.van-lieshout.com/2009/12/match-vm-and-windows-harddisks-using-powercli/ When the same code is executed using…
Nash A
  • 87
  • 6
0
votes
0 answers

Interacting with Get-WmiObject via .NET core

I need to get information about system. I can get it from Get-WmiObject with Powershell. But I need to gather it with .NET core application. I'm able to execute some basic commands like Get-Command or Get-Process. When i try to exexute…
0
votes
2 answers

How to get CPU percentage in powershell without using performance counter objects?

I'm trying to get CPU Percentage from multiple computers in my organization and some of these computers due to registry failure or corruption, their performance counters doesn't return any data. I've been trying to find a code to find the CPU…
0
votes
1 answer

How to resolve a gwmi : Invalid class "WmiMonitorID" PowerShell error?

I getting the following error: gwmi : Invalid class "WmiMonitorID" At line:1 char:1 + gwmi WmiMonitorID -Namespace root\wmi | ForEach-Object {($_.UserFrie ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidType: (:)…
newcool
  • 319
  • 2
  • 20