Topic: WMIC commands do not work  (Read 448 times)

WMIC commands do not work
« on: February 07, 2020, 01:12:32 AM »

respect88

  • Apprentice
  • *
  • Date Registered: Feb 2020
  • Posts: 7
I have the latest build of Win10XPE and when I try to run any WMIC commands, I get an error. With vanilla WinPE I would just need to include the WMI optional package and they would work.

Re: WMIC commands do not work
« Reply #1 on: February 07, 2020, 02:09:19 PM »

Malok

  • Chef
  • ***
  • Location: Canada
  • Date Registered: Aug 2016
  • Posts: 202
I don't think that WMI is Supported natively in XPE... you need the Win10ADK to install.

I never tried to setup XPE for WMI but you can try to install missing packages in your build and test if it works.

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-add-packages--optional-components-reference

Install the following packages

WinPE-Scripting
WinPE-WMI
WinPE-StorageWMI
WinPE-XML
WinPE-MDAC
WinPE-HTA

cmd example on a mounted image.

Code: [Select]
dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"

This is just a QS it might be more complicated.. than just that...



Re: WMIC commands do not work
« Reply #2 on: February 07, 2020, 05:17:26 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Win10XPE is WinRE Based

Quote
The default Windows RE image contains the following built-in optional components: | Included Optional Component | | ---- | | WinPE-EnhancedStorage | | WinPE-Rejuv | | WinPE-Scripting | | WinPE-SecureStartup | | WinPE-Setup | | WinPE-SRT | | WinPE-WDS-Tools | | WinPE-WMI |

Re: WMIC commands do not work
« Reply #3 on: February 07, 2020, 05:34:58 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Quote
The base WinRE image includes these Windows PE Optional Components:
•Microsoft-Windows-Foundation-Package
•WinPE-EnhancedStorage
•WinPE-Rejuv
•WinPE-Scripting
•WinPE-SecureStartup
•WinPE-Setup
•WinPE-SRT
•WinPE-WDS-Tools
•WinPE-WMI
•WinPE-StorageWMI-Package (added to the base image in Windows 8.1 and Windows Server 2012 R2)
•WinPE-HTA (added to the base image in Windows 10)

Re: WMIC commands do not work
« Reply #4 on: February 07, 2020, 07:51:01 PM »

respect88

  • Apprentice
  • *
  • Date Registered: Feb 2020
  • Posts: 7
Okay, so if the WMI package is already included in the base WinRE.wim that Win10XPE uses, then it should work out of the box.  Any idea why it doesn't?

Re: WMIC commands do not work
« Reply #5 on: February 07, 2020, 08:52:14 PM »

respect88

  • Apprentice
  • *
  • Date Registered: Feb 2020
  • Posts: 7
I wonder if I need WinPE-MDAC to help with the WMI queries. How can I add the WinPE-MDAC package to Win10XPE?

I built Win10XPE with all default options. This is the error when trying to run WMIC queries.

Re: WMIC commands do not work
« Reply #6 on: February 07, 2020, 09:30:00 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Quote
"X:\Windows\System32\wbem\WMIC.exe"
or from RUN > WMIC
or
x:\windows\system32>wmic
wmic:root\cli>baseboard get manufacturer
« Last Edit: February 07, 2020, 09:35:29 PM by James »

Re: WMIC commands do not work
« Reply #7 on: February 07, 2020, 09:50:21 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Nevermind - I pull the project name as well..

Re: WMIC commands do not work
« Reply #8 on: February 07, 2020, 10:55:42 PM »

respect88

  • Apprentice
  • *
  • Date Registered: Feb 2020
  • Posts: 7
I am still getting the same error.

Re: WMIC commands do not work
« Reply #9 on: February 08, 2020, 12:44:34 AM »

dazza

  • Chef
  • ***
  • Date Registered: Jan 2017
  • Posts: 244
Just a thought, usually WMI errors such as General Failure are permission related.

Has anyone tried running same command under administrator / switch to admin?

Re: WMIC commands do not work
« Reply #10 on: February 08, 2020, 01:11:07 AM »

respect88

  • Apprentice
  • *
  • Date Registered: Feb 2020
  • Posts: 7
Just a thought, usually WMI errors such as General Failure are permission related.

Has anyone tried running same command under administrator / switch to admin?

Yes I have tried, still no luck, nice thought.

Re: WMIC commands do not work
« Reply #11 on: February 08, 2020, 12:38:19 PM »

dazza

  • Chef
  • ***
  • Date Registered: Jan 2017
  • Posts: 244
Just booted an older version of Win10XPE I had lying around and WMIC worked fine.

Also on a brand new build of Win10XPE WMIC doesn't work, but a GUI for WMI got the value perfectly fine.

Very odd - excuse me jumping in on your thread, just curious to experiment as I knew I had used it okay in past.


Re: WMIC commands do not work
« Reply #12 on: February 08, 2020, 12:41:33 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
try adding > Componants/MS Powershell
Which also requires NetFX

is what just worked for my test
« Last Edit: February 08, 2020, 12:42:17 PM by James »

Re: WMIC commands do not work
« Reply #13 on: February 08, 2020, 01:01:50 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Just NetFx was not enough - add Powershell to get command console without error message

Re: WMIC commands do not work
« Reply #14 on: February 08, 2020, 01:28:55 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
@Dazza
Do you have that App Download Link ??

Re: WMIC commands do not work
« Reply #15 on: February 08, 2020, 01:43:01 PM »

dazza

  • Chef
  • ***
  • Date Registered: Jan 2017
  • Posts: 244

Re: WMIC commands do not work
« Reply #16 on: February 08, 2020, 04:09:55 PM »

Malok

  • Chef
  • ***
  • Location: Canada
  • Date Registered: Aug 2016
  • Posts: 202
I created a new Project, included all previously mentioned packages and options

also added IE and MSI installer.

When I run the Microsoft WMIDiag utility it finds a lot of errors and some are fatal.

When I run Winmgmt /verifyrepository I get that the database is consistent.

Every command fails with the generic Failure on my builds. Win10-1909 x64.

At this point I have Bloated my expanded image to 2.5 gigs. that's 700 mo more, just trying to meet requirement loll

also when i run WMImgmt the snap-in fails to add to mmc, might be normal under PE idk. Finally Tried from PS an CMD promps with same results.

I attached the utility with post in case Link changes.


Re: WMIC commands do not work
« Reply #17 on: February 08, 2020, 04:37:34 PM »

dazza

  • Chef
  • ***
  • Date Registered: Jan 2017
  • Posts: 244
To be fair WMIDiag throws up lots of errors even when run in a normal Windows 10 install, but since the download link doesn't mention it is compatible with Windows 10 that could be why

Re: WMIC commands do not work
« Reply #18 on: February 08, 2020, 05:02:46 PM »

Malok

  • Chef
  • ***
  • Location: Canada
  • Date Registered: Aug 2016
  • Posts: 202
Yes, ignore classes registration errors and the basic services cores test are good.

Re: WMIC commands do not work
« Reply #19 on: February 08, 2020, 09:58:52 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Thank Dazza...
I created an App with their software...

 

Powered by EzPortal