I've created a VBScript that aims to change folder share names on a server. This is currently running as a logon script for my test users.
I've defined this function:
Private Function intChangeShareName()
Dim intPoz1, intPoz2, intIndex
Dim strPom
intChangeShareName = CONST_NO_CHANGE
strActions = strActions & strOldNameShare & vbcrlf
strPom = Trim(strOldNameShare)
If Left(strPom, 2) <> "\\" then Exit Function
intPoz1 = inStr(3, strPom, "\")
intPoz2 = inStr(3, strPom, ".")
If intPoz2 > 0 Then
strSrvName = Mid(strPom, 3, intPoz2 - 3)
strDomName = Mid(strPom, intPoz2 + 1, intPoz1 - intPoz2 - 1)
Else
strSrvName = Mid(strPom, 3, intPoz1 - 3)
strDomName = ""
End If
intIndex = 0
Do while intIndex <= UBound(arrOldSrv)
If UCase(strSrvName) = UCase(arrOldSrv(intIndex)) Then
If strDomName = "" Then
strNewNameSrv = arrNewSrv(intIndex)
strNewNameDom = ""
intChangeShareName = CONST_CHANGE
End If
If UCase(strDomName) = UCase(arrOldDom(intIndex)) Then
strNewNameSrv = arrNewSrv(intIndex)
strNewNameDom = "." & arrNewDom(intIndex)
intChangeShareName = CONST_CHANGE
End If
End If
intIndex = intIndex + 1
Loop
If intChangeShareName = CONST_CHANGE Then
strNewNameShare = "\\" & strNewNameSrv & strNewNameDom & Mid(strPom, intPoz1)
strActions = strActions & "* " & strNewNameShare & vbcrlf
blRequireLogoff = True
' Wscript.Echo "a " & strNewNameShare
End If
End Function
However every time I log in I get the following error: VBScript runtime error - Invalid procedure call or argument: 'Mid' - Code 800A0005
I don't see anything wrong with my Mid function, can someone please help me?