Fix WMIC invalid alias verb error

If you use WMIC commands extensively, you would have come across the error – ‘Invalid alias verb’. WMIC error messages are not much self explanatory, so they don’t help in debugging what’s wrong with the command you ran. I encountered this error quite a few times, and upon careful examination I was able to identify what was causing this.

Below was one such instance I got the error

Advertisement
c:>wmic useraccount where username = 'test1' set PasswordRequired=true
= - Invalid alias verb.

With a quick look, it would not seem like there’s anything wrong with the command. It’s the white space in the where condition that was causing it. So same command with white space removed works perfectly fine.

c:>wmic useraccount where name='test1' set PasswordRequired=true
Updating property(s) of 'MYPCROOTCIMV2:Win32_UserAccount.Domain="MYPC",Name="test1"'
Property(s) update successful.

So if you encounter this error, you should check your command for such whitespaces, remove them and try running the command again.

Advertisement

3 thoughts on “Fix WMIC invalid alias verb error”

    • While relevant this does confuse the “fix” the whitespace refers to the space between “name” and “=”

  1. I am trying automate the variable launching a network capture tool, windump.exe. This is what I need to use, so I am trying to have the script determine the capture file size based on similar decisions points using the Max Disk Size of D: and the mount of free diskspace on D:. I am stuck at getting the information. Out of frustration about this same “Invalid alias verb.” message, I’ve split up the two queries, but neither work. I’ve also use Cygwin’s ported tail command to grab just the last line of the output… I’ll keep looking at that as the culprit, but any other suggestions?

    REM Determine capture file size/footprint based on percentage of available disk space
    set _qry_DSPACE=WMIC /Node:”%COMPUTERNAME%” Volume where DriveLetter=”D:” get FreeSpace
    echo %_qry_DSPACE%
    FOR /f “tokens=1″ %%a IN (‘%_qry_DSPACE% ^|tail -2’) DO set _Disc_Freespc=%%a
    set _qry_DCAP=WMIC /Node:”%COMPUTERNAME%” Volume where DriveLetter=”D:” get Capacity
    echo %_qry_DCAP%
    FOR /f %%b IN (‘%_qry_DCAP% ^|tail -2’) DO set _Disc_Cap=%%b

    Reply

Leave a Comment