PS2EXE icon indicating copy to clipboard operation
PS2EXE copied to clipboard

Windows 10 Patch from March 2024 breaks Powershell script

Open ELREYS opened this issue 1 year ago • 5 comments

Hi Guys unfortunally after the last Windows 10 Patch from March 2024, i have problem to run compiled Powershell script on my Laptops interesting just Powershell script that required Execution Policy change inside the script example:

This script works fine on Laptop that are not updated to the last Patch.

I start a debug on the first line, and the error start exactly there.

Im EventViewer you find a ucrtbase.dll error.

`Set-ExecutionPolicy -ExecutionPolicy Bypass; #$Variable $PrintServer = ""

#List connected Printers $ConnectedPrinter = Get-printer | Where-Object {$_.Type -eq "Connection"}

#Install all Printer from Server
#$AllPrinter = Get-Printer -ComputerName $PrintServer -Name $SelectedPrinter = Get-Printer -ComputerName $("\"+$PrintServer) | Select-Object Name | Out-GridView -Title "Drucker auswählen (Mit Ctrl/Strg Taste ist Mehrauswahl möglich!)" -PassThru

$ConnectionResult = Test-NetConnection -Hops 1 -ComputerName "" if ($ConnectionResult.Length -gt 0) { $ConnectionResult } foreach ($np in $SelectedPrinter) { $np.Name Add-Printer -ConnectionName $("\"+$PrintServer+""+$np.Name) Write-Host -ForegroundColor Green $("Drucker " +$np.Name+" wurde erfolgreich installiert. ")

} Write-Host -ForegroundColor Green "Drucker wurden erfolgreich installiert."

Write-Host -BackgroundColor Black -ForegroundColor Yellow "Bitte Standard-Drucker auswählen."

$SortedPrinter = Get-Printer | Where-Object {$_.Type -eq "Connection"} | Sort-Object $SelectedPrinter = $SortedPrinter | Select-Object ShareName | Out-GridView -Title "Standard-Drucker auswählen" -PassThru write-host -ForegroundColor Green $SelectedPrinter.Name

$DefaultPrinter = Get-CimInstance -ClassName Win32_Printer -Filter ("ShareName="+("'"+($SelectedPrinter.ShareName)+"'")) $DefaultPrinter Invoke-CimMethod -InputObject $DefaultPrinter -MethodName SetDefaultPrinter

Write-Host "Vorgang abgeschlossen"

` I just collect the last KB interesting there was also a Malware KB but ist not listed on my Laptop.

KB890830 KB5035845 KB5034763 Intel Corporation Extension Intel Corporation Display KB5001716

I hope you have a solution for this or an explanation.

Thanks

Giuseppe

ELREYS avatar Mar 14 '24 11:03 ELREYS

Hello @ELREYS,

I am not aware of any change with the monthy update regarding PS2EXE.

What error is happening? What happens if you omit the (I think unnecessary) Set-ExecutionPolicy line? Did you check if a virus scanner blocked the script? Maybe there was a change that the patch induced reboot put into effect?

Greetings

Markus

MScholtes avatar Mar 15 '24 12:03 MScholtes

Hello MScholtes Thank you fro the reply there are my screenshoot with th error message

microsoft error powershell

microsoft error powershell2

After this error message you can retry to run the script but he wont start anymore just a quick run and the closed again without error message.

ELREYS avatar Mar 18 '24 12:03 ELREYS

Hello @ELREYS,

follow the error message: please run your the programm / your script elevated (as an Administrator), it cannot work as a standard user.

Greetings

Markus

MScholtes avatar Mar 18 '24 16:03 MScholtes

I did but give me the same error Inviato da iPhone

Il giorno 18 mar 2024, alle ore 17:11, MScholtes @.***> ha scritto:



Hello @ELREYShttps://github.com/ELREYS,

follow the error message: please run your the programm / your script elevated (as an Administrator), it cannot work as a standard user.

Greetings

Markus

— Reply to this email directly, view it on GitHubhttps://github.com/MScholtes/PS2EXE/issues/131#issuecomment-2004344164, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADHYL6AQLMURMROOGCM5HNDYY4G2DAVCNFSM6AAAAABEV3X5DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBUGM2DIMJWGQ. You are receiving this because you were mentioned.Message ID: @.***>

ELREYS avatar Mar 18 '24 17:03 ELREYS

Hello @ELREYS,

please start your script non-compiled directly from Powershell and see if it works. I do not see any influence of PS2EXE to the issue you face.

Greetings

Markus

MScholtes avatar Mar 20 '24 17:03 MScholtes