Board logo

标题: 工作站如何断开iSCSI虚拟盘 [打印本页]

作者: 逍遥    时间: 2006-3-28 12:17     标题: 工作站如何断开iSCSI虚拟盘

我要在工作站断开iSCSI虚拟盘,利用映射驱动器的方法来更新游戏。可我断不开工作站的iSCSI虚拟盘。请问如何操作?

有位高人发了精华贴(如下),可我看不懂,烦请高手指点。谢谢。

[原创]断开并重连iSCSI虚拟盘的脚本

本脚本用在服务器ccdisk1.3 客户端微软1.06和2.0都行,
如果服务端用的是别的,
请自行修改“iqn.2005-02.com.ricecake.iscsi:00”  

Dim fso,oShell   
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "SID.bat",0,true
If fso.DriveExists("G") Then      '这个G改为你的虚拟盘的盘符号
    oShell.run ("iscsicli logouttarget "&ReadSID),0,true:
    WScript.Sleep 1000
end if
If fso.DriveExists("G") Then      '这个G改为你的虚拟盘的盘符号
    oShell.run ("iscsicli logouttarget "&ReadSID),0,true:
    WScript.Sleep 1000
end if
If fso.DriveExists("G") Then      '这个G改为你的虚拟盘的盘符号
    Msgbox "虚拟盘正使用中,请检查是否某些程序正在使用
虚拟盘,"& vbCrLf &"包括虚拟光驱里的镜像文件是不是虚拟
盘的,如果有,"& vbCrLf &"请先关闭这些程序和窗口然后再
执行本操作。",64,"虚拟盘断开失败":
    Wscript.quit
end if
If (fso.FileExists(oShell.ExpandEnvironmentStrings("%WinDir%")&"\system32\iscsicpl.cpl")) Then
    oShell.run "iscsicli LoginTarget iqn.2005-02.com.ricecake.iscsi:00 T * * * * * * * * * * * * * * * 0",0,true
End If
Function ReadSID
   Const ForReading = 1, ForWriting = 2, ForAppending = 8
   Dim f
   Set f = fso.OpenTextFile("C:\sid.txt", ForReading)
   f.skip(25)
   ReadSID = f.Read(33)
End Function

============================================================

SID.bat如下

iscsicli sessionlist|find "Session Id">C:\SID.txt




欢迎光临 IT家园 (http://bbs.it998.com/) Powered by Discuz! 7.2