I’ve been spending some time recently working with Microsoft’s Hyper-V virtualisation platform and one of the major hassles I’ve experienced is having to use the command line rather than GUI for certain functions. If you’re not aware, Windows 2008 Core is a stripped down version of a standard Windows 2008 Server deployment and so has no GUI interface. That makes administering features such as iSCSI a little more challenging as this isn’t one of the features of Server Management.
If you use iSCSI in your Windows environment, you will be familiar with the standard iSCSI GUI. This GUI makes administering iSCSI incredibly simple (with functions like Quick Connect) or of course you can use the more advanced features that allow the configuration of security and other features. Image 1 shows an example of the iSCSI Initiator page from one of my Hyper-V test machines. You can just about see that some of the connections are established and some are inactive.
Of course there is no GUI to use in 2008 Core, so the fallback is to use the iscsicli.exe command. You can find a description of the iscsicli commands using the following link from Microsoft: iSCSI Users Guide. This Word document provides details on how to create, display and delete iSCSI connections from the command line. For example to list target devices, use the command “iscsicli listtargets” as shown in Image 2.
While these commands are good and useful, there are two problems; firstly they require logging onto the server to run them (I want to run them centrally) and secondly, the available commands don’t give me exactly what I want to know. To get the data I want, I’ve utilised WMI (Windows Management Instrumentation), which provides a huge amount of information on a running Windows system. The iSCSI details are all stored in classes that start MSiSCSI and MSiSCSIInitiator. I’ve created two Powershell scripts, called iSCSIListSessions and iSCSIListDevices. The first lists active and pending iSCSI sessions, the second is a bit more useful and lists sessions and the associated devices.
Each script requires the host name to be specified as a command line parameter. See Images 3 & 4 for example output. I’ve also attached both scripts to this post for download if anyone is interested in using them. Note: You use these scripts at your own risk. The scripts are pretty basic and assume the userid you’re logged in with is the one for accessing the remote server, so you need WMI permission on your logged in userid for this to work. If I get time, I may produce something more flexible that would allow credentials to be overridden.
Make sure you rename the file extension from .txt to .ps1 before using the scripts.
- Netapp: The Inflexibility of Flexvols (9,970)
- Windows Server 2012 (Windows Server “8″) – Storage Spaces (9,410)
- Enterprise Computing: Why Thin Provisioning Is Not The Holy Grail for Utilisation (7,863)
- Comparing iSCSI Targets – Microsoft, StarWind, iSCSI Cake and Kernsafe – Part I (5,844)
- Review: Compellent Storage Center – Part II (5,479)
- Data ONTAP 8.0 – Part III (5,065)
- Why Does Microsoft Hyper-V Not Support NFS? (4,901)
- Back to Blogging (4,451)
- How To: Enable iSNS Server in Windows 2008 (4,351)
- Windows Server 2012 (Windows Server “8″) – Virtual Fibre Channel (4,182)
- Comparing iSCSI Targets – Microsoft, StarWind, iSCSI Cake and Kernsafe – Part I (5)
- Why Does Microsoft Hyper-V Not Support NFS? (5)
- HUS VM – Hitachi’s New Midrange Baby (3)
- How To: Enable iSNS Server in Windows 2008 (3)
- EMC Releases All Flash VNX (3)
- Predicting the Future of IT (2)
- Enterprise Computing: Why Thin Provisioning Is Not The Holy Grail for Utilisation (2)
- Optimising Storage Architectures for SSD (2)
- Storage QoS – How Hard Can It Be? (2)
- Poll: Who’s The Best At Storage Management Software? (2)