Create bootable CUC CUCM CUP Image / ISO

The following script allows you to automatically create a bootable CUCM/CUC/CUP image without the need for any paid for software when you only have access to the update outside of put or the datastore for the new server. I have spent several hours on this, but I just wanted to make it simple. Only really for lab purposes, the checksum will fail due to the ISO being manipulated but essentially once you fill in the variables, you will just be left with a single ISO file in the staging directory.

To use;
1. Download the mkisofs.exe file as described in the script
2. Paste script below into Powershell ISE Script Editer
3. Modify the variables
4. Execute the script. Simple.

Tested creating an ISO on a Windows 10 machine and running the ISO on a ESXI server.

Thanks for this guy Aaron Harrison as per the URL, was helpful in the finding out the mkisofs.exe command syntax.
http://www.ipcommute.co.uk/technical-articles/17--creating-isolinux-boot-dvds-with-free-software-cucm-uccx-cups.html


Clear-Host
#This script creates a bootable Cisco ISO image. Useful for lab purposes.
#V1.0
#Author - Squirrely

#Usage
#Fill in variables below.
#download Sample mkisofs from https://osdn.net/projects/sfnet_mkisofs-md5/ - for windows and extract

#Variables#
$ciscoISOFilePath = "D:\Downloads\CUP\CUP12.5\UCSInstall_CUP_12.5.1.12900-25.sgn.iso"
$stagingarea = "d:\temp\"
$mkisofsFilepath = "D:\Downloads\UCM12.5\Staging\mkisofs.exe"
#end of variables

$mkisofsnewFilepath = "$stagingarea" + "mkisofs.exe"
$mountdrive = Mount-DiskImage $ciscoISOFilePath -PassThru -Verbose
$driveletter = ($mountdrive | Get-Volume).DriveLetter
$outfile = (($ciscoISOFilePath.Substring($ciscoISOFilePath.lastIndexOf('\'))) -replace '\\', 'Bootable_')
$arguementList = "-o $outfile -R -J -hide-rr-moved -v -d -N -no-emul-boot -boot-load-size 32 -boot-info-table -b isolinux/isolinux.bin ."

Copy-Item $mkisofsFilepath -Destination $stagingarea -Force -Verbose
Unblock-File $mkisofsnewFilepath -Verbose
Copy-Item -path "$driveletter`:\" -Destination "$stagingarea\iso" -Recurse -Force -Verbose
Remove-Item "$stagingarea\iso\isolinux\isolinux.bin" -Verbose -Force
Copy-Item "$stagingarea\iso\isolinux\isolinux.bin.orig" "$stagingarea\iso\isolinux\isolinux.bin" -Verbose -Force
Set-Location "$stagingarea\iso"
Set-ItemProperty -Path "$stagingarea\iso\isolinux\isolinux.bin" -Name IsReadOnly -Value $false -Verbose
#Start-Process -FilePath "cmd.exe" -ArgumentList "/k $mkisofsnewFilepath $arguementList" -WorkingDirectory "$stagingarea\iso"
Start-Process -FilePath $mkisofsnewFilepath -ArgumentList $arguementList  -NoNewWindow -PassThru -Wait
Move-Item $outfile -destination $stagingarea
Set-Location $stagingarea
Remove-Item "$stagingarea\iso", $mkisofsnewFilepath -Force -Recurse
Dismount-DiskImage $ciscoISOFilePath




Comments

  1. The above script doesn't work even if you follow the variable change precisely. I even take out "space" for directory, doesn't work.

    I can see the ISO mounted to a drive letter.
    I can see lots of script processing moves.
    I can see files being generated in the staging area isolinux and all that good stuff.

    But toward the end, I get something like this consistently:

    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:30 char:1
    + Start-Process -FilePath $mkisofsnewFilepath -ArgumentList $arguementL ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

    Move-Item : Cannot find path 'C:\temp\staging\iso\Bootable_UCSInstall_UCOS_UNRST_12.5.1.13900-152.sgn.iso' because it
    does not exist.
    At line:31 char:1
    + Move-Item $outfile -destination $stagingarea
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\temp\staging...900-152.sgn.iso:String) [Move-Item], ItemNotFoundExce
    ption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveItemCommand

    Remove-Item : Cannot find path 'C:\temp\staging\mkisofs.exe' because it does not exist.
    At line:33 char:1
    + Remove-Item "$stagingarea\iso", $mkisofsnewFilepath -Force -Recurse
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\temp\staging\mkisofs.exe:String) [Remove-Item], ItemNotFoundExceptio
    n
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

    PS C:\temp\staging>

    ReplyDelete
    Replies
    1. I've just seen this now, sorry it didn't work for you. I just pasted it into my computer and it worked so I dont know why it didn't work for you sorry. Looking at the above, for whatever reason the script couldn't copy mkisofs.exe to the staging directory (C:\temp\staging\mkisofs.exe) or something locally is preventing it from executing. Cheers

      Delete
    2. Hey so I dug this up when I needed to create a bootable ISO :) I had the same failure as Whosjohnny, and I managed to fix it by copying all the files from the Mkisofs binary zip into the staging directory. I would imagine that only the "cygwin1.dll" file was needed but I was in a hurry and didn't troubleshoot it further :)

      Delete
    3. Same thing happened. I added these 2 lines to copy cygwin1 over:
      $mkisofsFilepath2 = "E:\Software\Tools\mkisofs\cygwin1.dll"
      Copy-Item $mkisofsFilepath2 -Destination $stagingarea -Force -Verbose

      Delete

Post a Comment

Popular posts from this blog

Configuring Oracle 12c backups on Veritas Backup Exec 16.

Configuring Cisco CME Voice Gateway (VG) for incoming and outgoing calls using Sipgate trunk