Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use with Set-MpPreference? #3

Open
vmiheer opened this issue Oct 20, 2016 · 3 comments
Open

Can't use with Set-MpPreference? #3

vmiheer opened this issue Oct 20, 2016 · 3 comments

Comments

@vmiheer
Copy link
Contributor

vmiheer commented Oct 20, 2016

Set-MpPreference : Cannot process argument transformation on parameter 'DisableRealtimeMonitoring'. Cannot convert
value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as
$True, $False, 1 or 0.
At line:1 char:45

  • Set-MpPreference -DisableRealtimeMonitoring False; pause
  •                                         ~~~~~
    
    • CategoryInfo : InvalidData: (:) [Set-MpPreference], ParameterBindingArgumentTransformationException
    • FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-MpPreference
@vmiheer
Copy link
Contributor Author

vmiheer commented Oct 20, 2016

Sorry I guess, you had already mentioned argument should be program and not commandLet. Should this be extended to take command blocks as argument?

@ecsousa
Copy link
Owner

ecsousa commented Oct 20, 2016

So, actually, I have implemented the ability for executing CmdLets on 5308514

But the problem is: when you execute:

sudo Set-MpPreference -DisableRealtimeMonitoring $False

I need to convert all parameters into string, in order to rewrite them as a command line argumento for a new PowerShell instance. In this scenario, $False get converto into the string 'False', which the new PowerShell instance is not able to implicit convert it back to a Boolean type.

I have to say I'm not entirely sure on how I would be able to get it working properly. I will try to think of something.

In the meantime, there is two work arounds that you can use:

sudo Set-MpPreference -DisableRealtimeMonitoring 0

or

sudo Set-MpPreference -DisableRealtimeMonitoring '$False'

I will also update README.md. I forgot to do so when I implemented support for CmdLets and .ps1 scripts.

@vmiheer
Copy link
Contributor Author

vmiheer commented Oct 23, 2016

That workaround looks great. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants