We have a legacy app that plays videos off a CD. The app will not launch if the disc is not available. I created an ISO file from the disc but needed a way to auto mount the disc during logon so any user who signed into the PC could use the application.
I finally came up with an easy solution and am documenting here. Feel free to use and customize to fit your needs. You need admin rights to complete these steps. Also, I have only tested this on Windows 8.1.
Step 1: Create a new folder, mine is C:\ISO\
Step 2: In C:\ISO\, create a new text file called AutoMountISO.txt, then edit the file and paste the following command (change the path and ISO name to match your setup):
Mount-DiskImage -ImagePath “C:\ISO\Test-ISO.iso”
Step 3: Rename AutoMountISO.txt to AutoMountISO.ps1, this will make it a PowerShell script.
Step 4: Run gpedit.msc to edit the computer’s Local Group Policy
Step 5: In Group Policy Editor, navigate to:
Local Computer Policy > Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)
Step 6: Open the “Startup” key, browse to the “PowerShell Scripts” tab and add the script
In the “For this GPO, run scripts in the following order:” drop-down box, choose “Run Windows PowerShell scripts first”
Step 7: Click Apply, then OK, and restart the computer.
That’s it! For some reason, this didn’t work the first time I rebooted the computer. However, the next time I logged in the ISO mounted as expected and has continued to work ever since. Even if the ISO is ejected, it will mount again at the next logon.
UPDATE: I’ve found I need to run the script manually once (right-click and choose “Run in Powershell”) as a user with Administrator rights. This will prompt to enable the correct Powershell execution policy. Once that has been done, it should mount the ISO correctly after each reboot.