winutil icon indicating copy to clipboard operation
winutil copied to clipboard

After executing the command I get bombarded with errors

Open Ruhto opened this issue 2 years ago • 6 comments

Describe the bug After I type iwr -useb https://christitus.com/win | iex into the powershell as adminstrator I get these errors: iex : At line:9066 char:5

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

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

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

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

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

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

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

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

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

Class keyword is not allowed in ConstrainedLanguage mode. At line:9078 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 mand

To Reproduce Steps to reproduce the behavior:

  1. Go to 'powershell as adminstrator'
  2. Click on 'paste iwr -useb https://christitus.com/win | iex'
  3. Scroll down to 'see the errors'
  4. See error

Expected behavior Seeing the program open as shown in many videos

Screenshots image

Additional context Add any other context about the problem here.

Ruhto avatar Jan 04 '24 14:01 Ruhto

At line:9066 char:5

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

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

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

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

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

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

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

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

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

Class keyword is not allowed in ConstrainedLanguage mode. At line:9078 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 mand

Test the following commands:

$ExecutionContext.SessionState.LanguageMode

  • If it's set to ConstrainedLanguage, you may try running $ExecutionContext.SessionState.LanguageMode = "FullLanguage" in that session then attempting to run the utility again. (irm christitus.com/win | iex)

and

Get-ExecutionPolicy

  • If this is set to something other than Unrestricted, you may try running Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted in that session then attempting to run the utility again. (irm christitus.com/win | iex)

munkk01 avatar Jan 04 '24 14:01 munkk01

At line:9066 char:5

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

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

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

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

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

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

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

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

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

Class keyword is not allowed in ConstrainedLanguage mode. At line:9078 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 mand

Test the following commands:

$ExecutionContext.SessionState.LanguageMode

* If it's set to `ConstrainedLanguage`, you may try running `$ExecutionContext.SessionState.LanguageMode = "FullLanguage"` in that session then attempting to run the utility again. (`irm christitus.com/win | iex`)

and

Get-ExecutionPolicy

* If this is set to something other than `Unrestricted`, you may try running `Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted` in that session then attempting to run the utility again. (`irm christitus.com/win | iex`)

Thank you, language mode is constrained but when I try to run the command to solve it gives these errors: 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
    

Ruhto avatar Jan 04 '24 15:01 Ruhto

Try reversing the command order here:

  • Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted ->
  • $ExecutionContext.SessionState.LanguageMode = "FullLanguage"

munkk01 avatar Jan 04 '24 15:01 munkk01

Same error...

Ruhto avatar Jan 04 '24 16:01 Ruhto

Nvm I managed to solve it because I remembered I put on these safety features mentioned in this video https://www.youtube.com/watch?v=zW69MisrsWk&t

Ruhto avatar Jan 04 '24 19:01 Ruhto

Closed due to inactivity

github-actions[bot] avatar Feb 20 '24 03:02 github-actions[bot]