winutil icon indicating copy to clipboard operation
winutil copied to clipboard

Script won't run

Open zapdady opened this issue 1 year ago • 12 comments

This is what I get when I run the script:

PS C:\WINDOWS\system32> iwr -useb https://christitus.com/win | iex iex : At line:12832 char:5

  • class WingetFailedInstall : Exception {
    
  • ~~~~~
    

Class keyword is not allowed in ConstrainedLanguage mode. At line:12832 char:11

  • class WingetFailedInstall : Exception {
    
  •       ~~~~~~~~~~~~~~~~~~~
    

Unexpected token 'WingetFailedInstall' in expression or statement. At line:12838 char:5

  • class ChocoFailedInstall : Exception {
    
  • ~~~~~
    

Class keyword is not allowed in ConstrainedLanguage mode. At line:12838 char:11

  • class ChocoFailedInstall : Exception {
    
  •       ~~~~~~~~~~~~~~~~~~
    

Unexpected token 'ChocoFailedInstall' in expression or statement. At line:12844 char:5

  • class GenericException : Exception {
    
  • ~~~~~
    

Class keyword is not allowed in ConstrainedLanguage mode. At line:12844 char:11

  • class GenericException : Exception {
    
  •       ~~~~~~~~~~~~~~~~
    

Unexpected token 'GenericException' in expression or statement. At line:1 char:40

  • iwr -useb https://christitus.com/win | iex
  •                                    ~~~
    
    • CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
    • FullyQualifiedErrorId : ClassesNotAllowedInConstrainedLanguage,Microsoft.PowerShell.Commands.InvokeExpressionCom How can I fix this? I loved this when it worked. John McIntyre

zapdady avatar May 23 '24 03:05 zapdady

Try setting your language mode to FullLanguage like this:

$ExecutionContext.SessionState.LanguageMode = "FullLanguage"

Run that as an administrator

CodingWonders avatar May 23 '24 10:05 CodingWonders

This is what I got: Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.

PS C:\WINDOWS\system32> $ExecutionContext.SessionState.LanguageMode = "FullLanguage" Cannot set property. Property setting is supported only on core types in this language mode. At line:1 char:1

  • $ExecutionContext.SessionState.LanguageMode = "FullLanguage"

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException     + FullyQualifiedErrorId : PropertySetterNotSupportedInConstrainedLanguage

PS C:\WINDOWS\system32> Any more suggestions?By the way, thanks for your help. I'm sure we have "never been closer" to finding a solution. :)JMc

On Thursday, May 23, 2024 at 03:34:36 AM PDT, CodingWonders ***@***.***> wrote:  

Try setting your language mode to FullLanguage like this: $ExecutionContext.SessionState.LanguageMode = "FullLanguage" Run that as an administrator

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zapdady avatar May 23 '24 15:05 zapdady

Thank you for your help.I am up and running.JMc

On Thursday, May 23, 2024 at 03:34:36 AM PDT, CodingWonders ***@***.***> wrote:  

Try setting your language mode to FullLanguage like this: $ExecutionContext.SessionState.LanguageMode = "FullLanguage" Run that as an administrator

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zapdady avatar May 23 '24 18:05 zapdady

I see that the solution @CodingWonders have provided has worked. I'm happy for you, @zapdady

Do you mind closing this issue as being completed? Thanks in advance 😄

og-mrk avatar May 25 '24 20:05 og-mrk

If responding to this email with --> please close ticket #1994.the problem has been resolved and completed, does the trick, then we are good.If I need to do anything else, please let me know,John McIntyre On Saturday, May 25, 2024 at 01:22:48 PM PDT, Mr.k @.***> wrote:

I see that the solution @CodingWonders have provided has worked. I'm happy for you, @zapdady

Do you mind closing this issue as being completed? Thanks in advance 😄

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zapdady avatar May 25 '24 20:05 zapdady

@og-mrk, I think that, as a way to prevent this problem, we should detect the language mode and check if it is constrained right at the beginning (obviously if the constrained language mode lets us do that in the first place!)

CodingWonders avatar May 25 '24 20:05 CodingWonders

@og-mrk, I think that, as a way to prevent this problem, we should detect the language mode and check if it is constrained right at the beginning (obviously if the constrained language mode lets us do that in the first place!)

@CodingWonders, interesting... now after trying a bit on how to do this, I can see why it's such a challenge, I'll continue working on this, if you find anything that might help, feel free to post them here 😄

Now it isn't a major problem so to speak, you can say it's of a lower priority compared to other issues, as we could assume most of the users using this tool are Windows Power Users.. but at the same time, I for one (as a user) don't like "jumping through hoops" to fix something that isn't technically my fault, and if we can fix this issue entirely, users won't need to check for LanguageMode every time they want to run WinUtil script, which would be quite nice 😎

og-mrk avatar May 25 '24 21:05 og-mrk

May I offer the following explanation as to why Chris's script stopped working for me?Please look at this YouTube video. https://www.youtube.com/watch?v=zW69MisrsWk&t=563sI followed the steps to disable these 3 Windows settings. After receiving the information from you guys, I went back in and reversed these settings back to default.After that reversal, everything worked as expected.I hope this brings to light, info interesting to you.JMc

On Saturday, May 25, 2024 at 01:40:12 PM PDT, CodingWonders ***@***.***> wrote:  

@og-mrk, I think that, as a way to prevent this problem, we should detect the language mode and check if it is constrained right at the beginning (obviously if the constrained language mode lets us do that in the first place!)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zapdady avatar May 25 '24 21:05 zapdady

@og-mrk, I have come up with a simple script that detects the language mode, and that might help you. Here is the link.

CodingWonders avatar May 26 '24 10:05 CodingWonders

Closed due to inactivity

github-actions[bot] avatar Jun 10 '24 00:06 github-actions[bot]

Working on a fix on launch for this issue

ChrisTitusTech avatar Aug 06 '24 23:08 ChrisTitusTech

Hopefully this gets fixed soon; family asked me to administrate a Windows 11 system but it's locked into "S" mode for some reason and won't let me turn it off. The command mentioned higher up didn't work either, so I'm at my wits-end...

ThisNekoGuy avatar Dec 05 '24 05:12 ThisNekoGuy