Powershell_script not working


#1

I am trying to use power-shell script to mount a File-storage in Azure.
Manually,the script is working but when I put the same code in powershell_script block what i found out was chef generates a temporary ps1 file with -
{
code


}.
But the file does not execute,just echoes out.
I guess Chef uses this command internally - “C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe” -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File “C:/Users/agl-user/AppData/Local/Temp/chef-script20180614-4776-pu0f29.ps1”

The script is executing properly but the File Storage is not mounting.


#2

What’s your powershell_script looks like?


#3

Thank you for replying.
The problem is now solved. It was mounting the Azure File Storage but once Chef finished executing the PS script, the file storage was automatically unmounted, so I thought the script was not working.
When I did the same thing for bash script, I had to manually unmount the storage.
Thank you again. Cheers. :grinning: