Forum Discussion
fhoext
Nov 24, 2023Copper Contributor
update powershell - script doesn't work anymore
Dear coll,
HELP ME!
I am a dummy powershell user; please, don't feed me with 10 line of code.
I have a simple script, replacing some text in a coda file; I made it with notepad++
It runs for years, but this week I updated to powershell7 and notepad++
and trouble started.
If I run the script as usual (with powershell) I get a powershell popup, very briefly (some red text) and that's it.
I checked all from every side, but I can not find any errors.
Enclosed, I sent the first 3 lines of the script.
Get-ChildItem 'C:\Users\skidc\Downloads\CODA\*.*' -Recurse | ForEach {
(Get-Content $_ | ForEach { $_ -replace '00403278488', '00463026629' }) |
Set-Content $_}
Get-ChildItem 'C:\Users\skidc\Downloads\CODA\*.*' -Recurse | ForEach {
(Get-Content $_ | ForEach { $_ -replace 'BE24733054476038 GBP', 'BE24733054476038GBP GBP' }) |
Set-Content $_}
Get-ChildItem 'C:\Users\skidc\Downloads\CODA\*.*' -Recurse | ForEach {
(Get-Content $_ | ForEach { $_ -replace 'BE86731028224850 GBP', 'BE86731028224850GBP GBP' }) |
Set-Content $_}
6 Replies
Sort By
You could capture the error with an extra line at the top with Start-Transcript c:\temp\log.txt and a Stop-Transcript at the end. Run the script, and check the c:\temp\log.txt afterward...
- fhoextCopper ContributorDear,
I got a hint from IT support. It looks like Microsoft has blocked standard all script :
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a
Supplies !
let's try this one and see what happens.- Any update?