summaryrefslogtreecommitdiff
path: root/MAS/Separate-Files-Version/Troubleshoot.cmd
diff options
context:
space:
mode:
authorWindowsAddict <[email protected]>2024-08-18 04:48:57 +0530
committerWindowsAddict <[email protected]>2024-08-18 04:48:57 +0530
commitfb113c7c243190b267722d4a5fca48bc0a7a40e4 (patch)
tree47c159c42790bfccffae488f8d707800dcb3f723 /MAS/Separate-Files-Version/Troubleshoot.cmd
parent9efc3e49b9aa988b7e74c00b4131fd7c6485911a (diff)
downloadMicrosoft-Activation-Scripts-fb113c7c243190b267722d4a5fca48bc0a7a40e4.zip
Replace wmic.exe with Powershell in fix wmi
Diffstat (limited to 'MAS/Separate-Files-Version/Troubleshoot.cmd')
-rw-r--r--MAS/Separate-Files-Version/Troubleshoot.cmd10
1 files changed, 2 insertions, 8 deletions
diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd
index 415f204..e35d102 100644
--- a/MAS/Separate-Files-Version/Troubleshoot.cmd
+++ b/MAS/Separate-Files-Version/Troubleshoot.cmd
@@ -892,12 +892,6 @@ echo WMI rebuild is not recommended on Windows Server. Aborting...
goto :at_back
)
-for %%# in (wmic.exe) do @if "%%~$PATH:#"=="" (
-%eline%
-echo wmic.exe file is not found in the system. Aborting...
-goto :at_back
-)
-
echo:
echo Checking WMI
call :checkwmi
@@ -1030,12 +1024,12 @@ exit /b
:: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
set error=
-wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
+%psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 (set error=1& exit /b)
winmgmt /verifyrepository %nul%
if %errorlevel% NEQ 0 (set error=1& exit /b)
-cscript //nologo %windir%\system32\slmgr.vbs /dlv %nul%
+%psc% "try { $null=([WMISEARCHER]'SELECT * FROM SoftwareLicensingService').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
cmd /c exit /b %errorlevel%
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440" %nul1%
if %errorlevel% EQU 0 set error=1