Skip to content

Commit bcea456

Browse files
committed
replace Get-WmiObject with Get-CimInstance
1 parent 0763fef commit bcea456

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Install-Programs.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Begin
6868
[CmdletBinding(HelpURI = 'cmd')] param()
6969

7070
# installState 1=enabled, 2=disabled, 3=absent, 4=unknown
71-
if ((Get-WmiObject Win32_OptionalFeature | `
71+
if ((Get-CimInstance Win32_OptionalFeature | `
7272
where { $_.Name -eq 'NetFx3' -and $_.InstallState -eq 1 }) -eq $null)
7373
{
7474
HighTitle 'NetFx3 (please wait)'

Microsoft.PowerShell_profile.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ if (Test-Path($ChocolateyProfile)) {
8383
# interactive shell, otherwise it will interfere with command-lines like Flat.bat and modifying
8484
# the current working directory when we don't want it to!
8585

86-
$cmd = (Get-WmiObject win32_process -filter ("ProcessID={0}" -f `
87-
(Get-WmiObject win32_process -filter "ProcessID=$PID").ParentProcessID)).CommandLine
86+
$cmd = (Get-CimInstance win32_process -filter ("ProcessID={0}" -f `
87+
(Get-CimInstance win32_process -filter "ProcessID=$PID").ParentProcessID)).CommandLine
8888

8989
if ($cmd -notmatch 'cmd\.exe')
9090
{

Modules/Scripts/Get-ProductKey.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ Process
4646
{
4747
Write-Host
4848
Write-Host 'WMI OS'
49-
Get-WmiObject -ComputerName . Win32_OperatingSystem
49+
Get-CimInstance -ComputerName . Win32_OperatingSystem
5050

5151
Write-Host "`nWMI Method: (real?)" -ForegroundColor DarkYellow
52-
Write-Host ((Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey) -ForegroundColor DarkGray
52+
Write-Host ((Get-CimInstance -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey) -ForegroundColor DarkGray
5353

5454
Report 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform' 'BackupProductKeyDefault'
5555
Report 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' 'DigitalProductID'

0 commit comments

Comments
 (0)