- Community Home
- >
- Storage
- >
- Midrange and Enterprise Storage
- >
- StoreVirtual Storage
- >
- Re: Using powershell to set iSCSI targets and HP D...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2013 11:33 PM
07-14-2013 11:33 PM
Using powershell to set iSCSI targets and HP DSM Round Robin policy in Windows 2012
I am amazed at what you can do with powershell on Windows 2012. The goal of this post is to share a simple script that will:
1- Connect to a Lefthand VIP portal via iSCSI
2- Get my windows 2012 network interfaces that I named "Storage01 and Storage02"
3- Set a variable with the initial part of the LH IQN
4- Set an array variable with the LUNs presented by LH (only two for simplicity)
5- Make the iscsi connections to the LH VIP (3 storage nodes). Setting persistance and MPIO values.
6- After connecting the iscsi LUNs then proceed to print on screen the default policy of the connections which is "none" or "vendor specific" so you know what was it before changes.
7- Set via WMI the default policy of "Round Robin" on the connections.
Credits of the WMI goes to:
Notes:
I have 2 nics for iscsi in each node.
I have 4 Win2012 nodes.
I need to setup over 60 iSCSI volumes, so I saved a billion clicks in the Windows 2012 GUI per node
I have only tested this on Windows 2012.
I am using HP DSM
$LH_VIP ="172.128.172.100" "Connecting Target Portal $LH_VIP" New-IscsiTargetPortal –TargetPortalAddress $LH_VIP "Get Networks Cards Named StorageXX Where XX is a number starting with 01" $iscsiNICS = Get-NetIPAddress –AddressFamily IPv4 -InterfaceAlias Stor* $tIQN = "iqn.2003-10.com.lefthandnetworks:storage-cluster:" $tLUN = @("141:cl01-vm-001","143:cl01-vm-exch01") foreach ($objItem in $tLUN) { "Connecting to LUN $tIQN$objItem " Connect-IscsiTarget -InitiatorPortalAddress $iscsiNICS[0].IpAddress -IsPersistent $True -IsMultipathEnabled $True -NodeAddress $tIQN$objItem Connect-IscsiTarget -InitiatorPortalAddress $iscsiNICS[1].IpAddress -IsPersistent $True -IsMultipathEnabled $True -NodeAddress $tIQN$objItem } "Querying and Setting default MPIO Policy to Round Robin" $MPIOPolicy = (“Non-Selected”,”Failover Only”,”Round Robin”,”Round Robin with Subset”,”Least Queue Depth”,”Weighted Paths”,”Least Blocks”) $Policies = get-wmiobject -namespace ROOT\WMI -class DSM_QueryLBPolicy_V2 foreach($Policy in $Policies){ $Instance = $Policy.InstanceName $objShare = Get-WmiObject -Namespace ROOT\WMI -Class DSM_LB_Operations | where{$_.InstanceName -eq $Instance} $InParams = $objShare.GetMethodParameters(“DsmSetLoadBalancePolicyALUA”) Write-Host Current Policy is $MPIOPolicy[$policy.LoadBalancePolicy.LoadBalancePolicy] for $policy.InstanceName$policy.LoadBalancePolicy.LoadBalancePolicy = 2
"Changing policy from old value to Round Robin" $InParams.LoadBalancePolicy = $Policy.LoadBalancePolicy $Inparams1 = $InParams.LoadBalancePolicy $Inparams1.LoadBalancePolicy = 2 $Inparams.LoadBalancePolicy = $Inparams1 $outparams = $objShare.DsmSetLoadBalancePolicy($inparams.LoadBalancePolicy) If ($outparams.Status = 2){Write-Host Policy Set to $MPIOPolicy[$Inparams1.LoadBalancePolicy]} }
Hope you like it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2013 04:02 AM
07-24-2013 04:02 AM
Re: Using powershell to set iSCSI targets and HP DSM Round Robin policy in Windows 2012
Hi Erick
Thanks for sharing the information
Regards
Ravi