Jump to content

Two questions about getting this PS code to run in Autoit...


Draygoes
 Share

Recommended Posts

Hey all! I'm going a bit crazy with this, so maybe you guys can help. (I'm also extreamly tired, but I'm pretty sure that's not effecting the fact that this doesn't work.)

Right so, I'm trying to run this PS code that disables Windows Defender.

Set-MpPreference -DisableRealtimeMonitoring $true


But that code needs to be run as administrator.

The other problem is, the code that I tried didn't work at all. And I have no idea why.

 
Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Start-Sleep -Seconds 20 -Milliseconds 300" )

 

So, could someone help me figure out why that code doesn't work, so that I can get the other code to work?
Basically I'm trying to do this, but I need it to be ran as Admin.
 

Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Set-MpPreference -DisableRealtimeMonitoring $true" )



Thanks for yalls time.

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

  • Moderators

For the first snippet, it is no wonder it is not working, that is incorrect syntax for the Start-Sleep command. I would suggest reviewing the help on that.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

On 11/21/2022 at 5:15 PM, JLogan3o13 said:

For the first snippet, it is no wonder it is not working, that is incorrect syntax for the Start-Sleep command. I would suggest reviewing the help on that.

Ah, thanks for letting me know that. I'm so new to powershell, that I thought I had written that correctly. I'm learning. :)
Okay, I think one of the reasons this code isn't working is because I'm not running powershell as admin. How do I do that?
 

Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Set-MpPreference -DisableRealtimeMonitoring $true" )

 

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

  • Moderators

I would suggest Googling "powershell script require run as admin", the syntax is very close to AutoIt's....

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...