HotCakeX / Harden-Windows-Security

Harden Windows Safely, Securely using Official Supported Microsoft methods and proper explanation | Always up-to-date and works with the latest build of Windows | Provides tools and Guides for Personal, Enterprise, Government and Military security levels | Read The Rationale https://github.com/HotCakeX/Harden-Windows-Security/blob/main/Rationale.md
https://hotcakex.github.io
MIT License
1.37k stars 107 forks source link

[Bug]: At line:379 char:77 πŸ₯· #240

Closed Destroyarr closed 3 months ago

Destroyarr commented 3 months ago

EDIT : FOUND I HAVE TO RUN POWERSHELL 7 SEparately from Windows Terminal because Terminal is PS 5 OMG

Tools category

Harden Windows Security Script

Does your system meet the requirements?

Is your Windows installation genuine?

Please explain the bug

OMG!

the winver is 24h2 win11 26100.1

It appears there are some issues with the PowerShell script you're trying to execute. Let's break down the error messages:

  1. Unexpected token '??' in expression: The ?? operator is used for null coalescing in PowerShell, but it seems there's an issue with its usage in your script. Double-check the line where this operator is used.

  2. Unexpected token '?' in expression: Similar to the first error, there's an issue with the usage of the ? (ternary) operator. Verify the context in which it's being used.

  3. Missing closing ')' in expression: This error indicates that there's an unclosed parenthesis somewhere in your script. Check the lines where parentheses are used and ensure they are balanced.

  4. Missing closing '}' in statement block or type definition: This error suggests that a block of code (such as a loop or function) is missing its closing curly brace (}).

  5. Not all parse errors were reported: This message indicates that there might be additional errors beyond what's listed. Inspect the entire script for any other issues.

Please review your script, correct the errors, and try running it again. If you need further assistance, feel free to ask! 😊

PS C:\Users\User> (irm 'https://raw.githubusercontent.com/HotCakeX/Harden-Windows-Security/main/Harden-Windows-Security.ps1')+'P -G'|iex
iex : At line:379 char:77
+ ... ble -Name 'LogPath' -Value $($PSBoundParameters['LogPath'] ?? (Join-P ...
+                                                                ~~
Unexpected token '??' in expression or statement.
At line:382 char:46
+         $PSBoundParameters.Verbose.IsPresent ? ([System.Boolean]$Verb ...
+                                              ~
Unexpected token '?' in expression or statement.
At line:897 char:83
+ ... ystem.String]$ActionCheck = ($FeatureAction -eq 'Enabling') ? 'disabl ...
+                                                                 ~
Unexpected token '?' in expression or statement.
At line:898 char:84
+ ... stem.String]$ActionOutput = ($FeatureAction -eq 'Enabling') ? 'enable ...
+                                                                 ~
Unexpected token '?' in expression or statement.
At line:987 char:64
+ ...              [System.Int16]$TotalRequiredFiles = $IsLocally ? ($Files ...
+                                                                 ~
Unexpected token '?' in expression or statement.
At line:1085 char:39
+                 Copy-Item -Path ($GUI ? $SyncHash.LGPOZipTextBox.Text ...
+                                       ~
Unexpected token '?' in expression or statement.
At line:1085 char:38
+                 Copy-Item -Path ($GUI ? $SyncHash.LGPOZipTextBox.Text ...
+                                      ~
Missing closing ')' in expression.
At line:1083 char:27
+             if ($Offline) {
+                           ~
Missing closing '}' in statement block or type definition.
At line:944 char:37
+         Function Start-FileDownload {
+                                     ~
Missing closing '}' in statement block or type definition.
At line:335 char:11
+     begin {
+           ~
Missing closing '}' in statement block or type definition.
Not all parse errors were reported.  Correct the reported errors and try again.
At line:1 char:116
+ ... Harden-Windows-Security/main/Harden-Windows-Security.ps1')+'P -G'|iex
+                                                                       ~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Destroyarr commented 3 months ago

FOUND I HAVE TO RUN POWERSHELL 7 SEparately from Windows Terminal because Terminal is PS 5 OMG

HotCakeX commented 3 months ago

Yes, everything in this repository is made for the modern PowerShell that uses .NET Install latest PowerShell with this oneliner

Winget install Microsoft.PowerShell

or from MSFT Store https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D