Forum Discussion
Get-AzureStorageFileContent not working in script
Hi, I need help with one thing because I am writing a script that will download one file from Azure File Sever. Unfortunately, I cannot find the problem and the cause of the errors. When I run the script without saving, i.e. line by line in powershell, it works fine. Unfortunately, when I save the script to a file and call it from Powershell, it bursts with errors. Does anyone have any idea what this is caused by.
My uneducated guess is the script file is saved in a Unicode format that presents issues when called from your PowerShell session, which I'm further guessing is running under a different culture.
Because I'm a Skippy - sorry, Australian - I'm not terribly familiar with other culture settings but something you could try is re-saving the .ps1 script in Notepad as either ASCII or UTF-8 and then running that. It might also pay to delete the existing hyphens first and re-typing them while in Notepad before re-saving the script (but again, this is also just another guess - cultures really aren't my strength.)
It's a long shot and I'm 100% guessing, but the fact that both hyphens in front of each parameter within the red error message have translated to a different Unicode character is what has me guessing in this direction.
Cheers,
Lain
- LainRobertsonSilver Contributor
My uneducated guess is the script file is saved in a Unicode format that presents issues when called from your PowerShell session, which I'm further guessing is running under a different culture.
Because I'm a Skippy - sorry, Australian - I'm not terribly familiar with other culture settings but something you could try is re-saving the .ps1 script in Notepad as either ASCII or UTF-8 and then running that. It might also pay to delete the existing hyphens first and re-typing them while in Notepad before re-saving the script (but again, this is also just another guess - cultures really aren't my strength.)
It's a long shot and I'm 100% guessing, but the fact that both hyphens in front of each parameter within the red error message have translated to a different Unicode character is what has me guessing in this direction.
Cheers,
Lain
- Rakkos_SSWCopper Contributor
Thanks, when i save in Notepadd using UTF-8 BOM working fine 🙂