Reputation: 197
I am trying to execute the SetCustomShell
method from the WESL_UserSetting
class using the WMIC command. The class is in the non-default \\root\StandardCimv2\Embedded
namespace in Windows 10 Enterprise.
I already have the custom shell feature enabled, and I know the class is installed properly, because the command:
wmic /namespace:\\root\StandardCimv2\Embedded CLASS WESL_UserSetting CALL SetCustomShell /?
Produces this output:
Call [ In/Out ]Params&type Status
==== ===================== ======
SetCustomShell [IN ]CustomReturnCodes(array of sint32) Implemented
[IN ]CustomReturnCodesAction(array of sint32)
[IN ]DefaultAction(sint32)
[IN ]Shell(string)
[IN ]Sid(string)
[OUT]ReturnValue(uint32)
This also corresponds to Microsoft's documentation, (except it lists the parameters are in a different order), so I think I'm on the right track here. But I've tried to pass the arguments in a number of different ways, and wmic
just doesn't seem to understand what I'm trying to do.
I've tried named parameters (i.e. shell=xxx, Sid=xxx, etc.), enclosing the whole list in quotes, enclosing just the values in quotes, calling with parenthesis, and just blasting it with comma-separated values. Nothing seems to work. I always wind up with:
Invalid named parameter list.
Hint: <named param list> ::= <named param> | <named param> <named param list> where <named param> ::= <param name>=<param value>
Or:
Invalid format.
Hint: <paramlist> = <param> [, <paramlist>].
How do I call this method properly?
Ironically, I know how to do this with a VBScript or PowerShell. There are numerous examples on how to do this with a script in all sorts of languages. But I need to execute it from a group policy or during an OS deployment without having to rely on a script file being available somewhere where the client can see it, and this should be something I can do with a single command.
Upvotes: 1
Views: 3608
Reputation: 26
I believe something like the following:
wmic /namespace:\\root\StandardCimv2\Embedded CLASS WESL_UserSetting CALL SetCustomShell Sid="s-1-*" Shell="cmd.exe" DefaultAction=0 CustomReturnCodes=(0,1,2) CustomReturnCodesAction=(0,1,2)
Upvotes: 1