Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Created April 5, 2020 09:59
Show Gist options
  • Save manualbashing/c64982713665c5b562070b6e85244559 to your computer and use it in GitHub Desktop.
Save manualbashing/c64982713665c5b562070b6e85244559 to your computer and use it in GitHub Desktop.
Mount Volume in ARM script extension

RunOnce RegKey... Wont execute..

Run and RunOnce registry keys cause programs to run each time that a user logs on. The data value for a key is a command line no longer than 260 characters. 

RTFM!!!!!!

Scheduled Task with RunOnce:

C:\Users\Academy023> schtasks.exe /create /f /tn MountLabStorage /sc ONSTART /tr "powershell.exe -executionpolicy ByPass -command 'cmdkey /add:storage20200405101317.file.core.windows.net /user:Azure\storage20200405101317 /pass:5W5hrESZoxNRELvVpcsHE2XyKFpMv/dDhfW7QnKYk0W/CzvslWT/rlGss4Ww8CxVgm60YhLgY3L4ssKbiZnhzQ==;New-PSDrive -Name Y -PSProvider FileSystem -Root \\storage20200405101317.file.core.windows.net\share -Persist:1 ; schtasks.exe /delete /f /tn MountLabStorage'"
ERROR: Value for '/tr' option cannot be more than 261 character(s).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment