PowerShell V3 Scheduled Job to start iSCSI service for Hyper-V Server

PowerShell V3 Scheduled Job to start iSCSI service for Hyper-V Server
Hi Guys, During one of our maintenance activities which involved patching of our Hyper-V hosts i noticed that during the restart of the servers after patching all cluster shared volumes mapped to the cluster was showing up in redirected access mode as below.

I went through cluster event logs and saw that the msiscsi service went to a stopped state after the server went for a restart.

When i manually started the msiscsi service all the CSV’s showed up again in “Online” status.

To Tackle this problem i created a script to check and restart msisci service across all our Hyper-V Nodes if it was in stopped state using the new PSScheduledJob module in PowerShell V3 daily at 3am.

To Develop the script i used the failover cluster module.

ipmo failoverclusters -ErrorAction SilentlyContinue

The Below commands list out all the Hyper-V nodes which are part of nkngv1 cluster

Here’s The Entire small but powerful Script 🙂

After i Ran this script on my elevated powershell prompt i was able to see the Job created in task scheduler under “TaskSchedulerLibraryMicrosoftWindowspowershellscheduledjobs”

Please follow and like us:

Share this post

Post Comment