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,911)
- Windows Server 2012 (Windows Server “8″) – Storage Spaces (9,356)
- Enterprise Computing: Why Thin Provisioning Is Not The Holy Grail for Utilisation (7,813)
- Comparing iSCSI Targets – Microsoft, StarWind, iSCSI Cake and Kernsafe – Part I (5,789)
- Review: Compellent Storage Center – Part II (5,405)
- Data ONTAP 8.0 – Part III (5,045)
- Why Does Microsoft Hyper-V Not Support NFS? (4,821)
- Back to Blogging (4,450)
- How To: Enable iSNS Server in Windows 2008 (4,291)
- Windows Server 2012 (Windows Server “8″) – Virtual Fibre Channel (4,100)
- Windows Server 2012 (Windows Server “8″) – Storage Spaces (7)
- ViPR – Frankenstorage Revisited (5)
- Windows Server 2012 (Windows Server “8″) – Resilient File System (4)
- Virtualisation: Home Lab Update (4)
- Managing iSCSI on Windows 2008 Core with Hyper-V (4)
- Dell Allegedly Bid for Fusion-IO (4)
- Review: Compellent Storage Center – Part II (3)
- Defining Software Defined Storage (3)
- How To: Enable iSNS Server in Windows 2008 (3)
- Review: Sun Storage 7000 Unified Storage System – Part I (2)