OIS - iSCSI Automation

I recently completed a project where I needed to orchestrate and automate Windows 2008 R2 NIC settings and the iSCSI Initiator.


Recent SAN Upgrades/Modifications required a large number of host reconfiguration: Old iSCSI configurations removed and New iSCSI configurations applied. In this case, it was:

  • 125 different Hosts
  • 125 different NIC configurations
  • 125 different old iSCSI Initiator configurations
  • 125 different new iSCSI Initiator configurations

That is a lot of configuration! In fact, the manual process would require:

  • Individual Login on each Host
  • Hundreds of Windows/GUIs opened
  • Thousands of clicks


This is nothing I wanted to do manually, so I created a set of OIS policies that would handle the work. We now have a set of OIS policies which fully Automate/Orchestrate all required host iSCSI actions.


Policies created and executed for each host:

  1. Prep SCDEMO Hosts
    • Scan Hyper-V for Running VMs on the SAN
    • Gracefully Stop each VM Running on the SAN and Notify Admins
  2. Disable iSCSI Resources
    • Disable iSCSI NICs
    • Remove Persisted (Favorite) Targets
    • Logout of existing “Reconnecting…” Sessions
    • Remove existing Target Portals and Refresh Connections
  3. Enable iSCSI Resources
    • Add new IP Addresses to iSCSI NICs
    • This includes: Enable iSCSI NICs and Old IP Address Deletion
    • Add new Target Portals
    • Login to new Targets


Prep Hosts

Maintenance | SAN | 1.0 SCDEMO Hyper-V VHD Scan for Running VMs on SAN

Maintenance | SAN | 2.0 Stop VMs on SAN


Disable iSCSI Resources

Maintenance | SAN | 3.0 Disable iSCSI NIC

Maintenance | SAN | 4.0 Remove Favorite Target from iSCSI Initiator

Maintenance | SAN | 5.0 Logout of iSCSI Initiator Target Session

Maintenance | SAN | 6.0 Remove iSCSI Target Portal and Refresh


Enable iSCSI Resources

Maintenance | SAN | 7.0 Add IP Address to iSCSI NIC

Maintenance | SAN | 7.1 Enable iSCSI NIC

Maintenance | SAN | 7.2 Delete Old iSCSI IP Address

Maintenance | SAN | 8.0 Add Target Portal to iSCSI Initiator

Maintenance | SAN | 9.0 Login to iSCSI Initiator Target and Add Fav Target



Because this solution includes quite a few policies, command line scripts, PowerShell, C# code, and MSSQL tables and scripts, I have packaged it all up as a CodePlex project release (sanitized OIS_EXPORT - in fact, I took out all the “SCDEMO” references for the objects and variables).

If you are interested, you can find the export here: http://opalis.codeplex.com/releases/view/65136  (OIS - iSCSI Automation Kit v1.0)

I want to be clear, you should use these policies as examples. You will not be able to simply import them and click “Start”. The export is from the working set of policies that I created for a specific the environment. I have made them as dynamic as possible (even utilizing external data persistence in MSSQL), but still, your mileage will vary. In fact, the environment that I currently run (and ran this in) is OIS 6.2.2 installed on Windows Server 2003 x86 (to keep the PowerShell simple). All policies were built to automate/orchestrate against Windows Server 2008 R2 (many with SP1) machines.

DISCLAIMER: The project artifacts within the above referenced CodePlex project is currently compatible and tested against OIS 6.2.2 installed on Windows 2003 x86. Newer versions of OIS and/or the Windows OS where OIS is installed may require that these artifacts need to be updated to accommodate. This solution is AS IS, is not specifically supported and you should use it at your own risk. Please be aware of the impact each policy has on the intended targets before testing. ALWAYS use a test environment to vet your OIS projects.

Also, I want to send special thanks to this blog post for assistance with a PowerShell script to get iSCSI Port Numbers.

Anyway, I hope this was useful. If anything it should give you yet another idea on how you could use OIS in your datacenter. :)