Add

Fix for Windows 7 & wmic: Invalid XSL format (or) file name


In Windows 7, there is a bug with wmic and the /format switch. When using the /format switch, you will get the error “Invalid XSL format (or) file name.”

1. Example:

C:\Tmp>wmic /output:C:\tmp\procinfo.html CPU get Description,
DeviceID, Manufacturer, MaxClockSpeed, Name, Status, SystemName /format:hform.xsl
Invalid XSL format (or) file name.

2. Cause:

Windows looks for the XSL stylesheets but cannot find them, which produces the error above.

3. Resolution:

Copy *.xsl from x:\Windows\system32\wbem\en-US\ to x:\Windows\system32 – this can be done quicky from command prompt:

copy /y %WINDIR%\system32\wbem\en-US\*.xsl %WINDIR%\system32\

If you run your original wmic command (example in Section 1), there will be no errors and wmic will export data in the format required.

The Discussion

see what everyone is saying

  • IsaacM December 14th, 2011 at 7:20 am #1

    Still won’t work…

  • Curtis K December 16th, 2011 at 12:03 pm #2

    @IsaacM – did you get any errors when entering the commands in this post? I have just updated this post so that the command applies to Windows installed on any drive, other than C:\

    If the *.xsl files exist in %WINDIR%\system32\ and it still doesn’t work, try restart Windows and then test again.

  • Jordan van Bergen April 15th, 2012 at 4:20 am #3

    Did not work for me as well. Windows 7 64 bit version.

  • harry April 22nd, 2012 at 6:17 pm #4

    Thanks a million bro.. this worked like clockwork..

  • Jørgen May 17th, 2012 at 2:44 am #5

    @Jordan, I had the same problem also on Windows 7 64 bits. It worked for my user account and Administrator account, but not for the local system account. For some reason I had to use it under the local system account. A search on the internet, as mentioned above, only gave the solution to copy the csv.xsl file into the system32 directory which didn’t help. Also adjusting the PATH variable for the local system user didn’t help.

    But I noticed there was another format which did work. I did a search from the c:\windows directory to find this format.xsl file. The file was found in 4 different directories and it turned out that the file csv.xsl needed to be available in c:\windows\SysWOW64!? Don’t ask me why, but now it’s working as documented.

  • Viper5112 June 18th, 2012 at 11:15 pm #6

    The files are already in the C:\Windows\SysWOW64\wbem\en-US and they need to be in the system32 folder on a 64bit system. I copied the 5 files into the c:\windows\system32 folder and it worked straight away.

  • kilby July 11th, 2012 at 11:54 pm #7

    The listed solution worked fine for me under Win7 64bit

    Though I had to run the copy as Asministrator

  • greenhart July 11th, 2013 at 4:54 am #8

    I found another way around it. For the /format switch I used:

    /format:”%WINDIR%\system32\wbem\en-us\htable”

    That’s for a html file. You’d have to know the name of the XSL file for other formats.

  • Tony October 22nd, 2013 at 7:06 am #9

    Thanks it works!

    Just close the cmd windows and open a new one

Respond

get in on the action.

* Required

Random Posts Recent Comments

  • Tony Says:

    Thanks it works! Just close the cmd windows and open a new one...

  • greenhart Says:

    I found another way around it. For the /format switch I used: /format:"%WINDIR%\system32\wbem\en-...

  • Jari Aalto Says:

    To determine OS, you can also use command lsb_release(1). See the options how to extract only part o...

  • shadovice Says:

    thanks! it worked like a charm, although there is still minor typo remained: rpm -Uvh http://downlo...

  • Joh Says:

    Great, thank you. Also works with the new version and Centos 6.3 without test repo, just install ...

  • sierprinsky Says:

    Muchas gracias por tu aporte :)...

  • kilby Says:

    The listed solution worked fine for me under Win7 64bit Though I had to run the copy as Asministr...

  • Viper5112 Says:

    The files are already in the C:\Windows\SysWOW64\wbem\en-US and they need to be in the system32 fold...

  • slowmOoh Says:

    Thanks...

  • Jørgen Says:

    @Jordan, I had the same problem also on Windows 7 64 bits. It worked for my user account and Admini...

Tag Cloud

backup mail backup mail server backup mailserver backup mx cd burner control multiple computers with one keyboard and mouse control panel DAG disk benchmark disk performance test DNS DNS check enable dag repo free cd burner free DNS check hdd benchmark http proxy install keyboard over network kloxo kloxo 64-bit kvm lxadmin lxadmin-master lxlabs mouse over network mtr ping plotter proxy proxy hide IP qmail repo RPM rpmforge share keyboard and mouse over network share keyboard over network share mouse and keyboard share mouse over network software kvm squid squid hide IP squid proxy trace traceroute tracert