Jump to content

Recommended Posts

Posted

Good day,
I hope that the day finds you all very well!

I have been experiencing major issues with regards to executing .ps1 script within AutoIt in Windows 10 LTSC!!

I finally discover that "tucked away in the background" , was an error message stating, "...running scripts is disabled on this system...". This was discovered after some 1-2 hours of wondering why my script was NOT executing as expected!
• See this: [Click_Me] ...and this... [Click_Me]

Here is the original script...

; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
ExcludeMe()
; -----------------------------------------------
Func ExcludeMe()
    Local $sPS1Script = "D:\Install\OS\Scripts\ExcludeMe.ps1"
    ; -----------------------------------------------
    Run('powershell.exe -File ' & '"' & $sPS1Script & '"', "", @SW_HIDE)
EndFunc   ;==>ExcludeMe
; -----------------------------------------------

...and here is the updated script...

; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
ExcludeMe()
; -----------------------------------------------
Func ExcludeMe()
    Local $sPS1Script = "D:\Install\OS\Scripts\ExcludeMe.ps1"
    ; -----------------------------------------------
    Run('powershell.exe -ExecutionPolicy Bypass -File ' & '"' & $sPS1Script & '"', "", @SW_HIDE)
EndFunc   ;==>ExcludeMe
; -----------------------------------------------

All that was required was the addition of the parameter, "-ExecutionPolicy Bypass"!! "WOW!!!"

I must admit that I was rather surprised...that it would appear...that no one else was experiencing this issue!!

I hope this information will be of some practicable employment?

Posted
2 hours ago, mr-es335 said:

I must admit that I was rather surprised...that it would appear...that no one else was experiencing this issue!!

Not an issue, a feature. Otherwise one can run a malicious .ps1 without knowing. Shouldn't be used unless by the owner of the PC willingly does it. Safety first.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
  • Recently Browsing   0 members

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