Created
November 6, 2017 02:21
-
-
Save keyrage/1c684cab74cb113eaea8f05d3ca64514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####Mount an ISO as a drive in Windows | |
powershell_script 'Mount ISO' do | |
code <<-EOH | |
Mount-DiskImage -ImagePath "<<PATH TO ISO>>" | |
if ($? -eq $True) | |
{ | |
echo "ISO was mounted Successfully." > #{ENV[TEMP]}\\ISO_Mounted_Successfully.txt | |
exit 0; | |
} | |
if ($? -eq $False) | |
{ | |
echo "ISO Failed to be mounted." > #{ENV[TEMP]}\\ISO_Mount_Failed.txt | |
exit 2; | |
} | |
EOH | |
action :run | |
guard_interpreter :powershell_script | |
not_if "((gwmi -Class Win32_LogicalDisk | Where-Object {$_.VolumeName -eq \"<<VOLUME NAME>>\"}).VolumeName -eq \"<<VOLUME NAME>>\")" | |
end | |
#### DISMOUNT AN ISO | |
powershell_script 'Dismount ISO' do | |
code <<-EOH | |
Dismount-DiskImage -ImagePath "<<PATH TO ISO>>" | |
EOH | |
action :run | |
guard_interpreter :powershell_script | |
only_if "((gwmi -Class Win32_LogicalDisk | Where-Object {$_.VolumeName -eq \"<<VOLUME NAME>>\"}).VolumeName -eq \"<<VOLUME NAME>>\")" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment