 Rank: Advanced Member Medals:   Joined: 9/13/2010(UTC) Posts: 708 Location: Minnesota
Thanks: 1 times Was thanked: 44 time(s) in 32 post(s)
|
for now you could install the %computername% method and use my quick vbscript to rename the session. Code:strComputer = "." 'could be any computer, not just the local one '
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name LIKE '%ScreenConnect Guest Service%'")
dim temp
dim OriginalImagePath
For Each objService in colServiceList
temp = objService.DisplayName
next
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\services\" & temp
strValueName = "ImagePath"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
OriginalImagePath = strValue
'Wscript.Echo OriginalImagePath
if Right(OriginalImagePath,1) = """" then
OriginalImagePath = left(OriginalImagePath, len(OriginalImagePath) - 1)
end if
Function URLEncode(ByVal str)
Dim strTemp, strChar
Dim intPos, intASCII
strTemp = ""
strChar = ""
For intPos = 1 To Len(str)
intASCII = Asc(Mid(str, intPos, 1))
If intASCII = 32 Then
strTemp = strTemp & "+"
ElseIf ((intASCII < 123) And (intASCII > 96)) Then
strTemp = strTemp & Chr(intASCII)
ElseIf ((intASCII < 91) And (intASCII > 64)) Then
strTemp = strTemp & Chr(intASCII)
ElseIf ((intASCII < 58) And (intASCII > 47)) Then
strTemp = strTemp & Chr(intASCII)
Else
strChar = Trim(Hex(intASCII))
If intASCII < 16 Then
strTemp = strTemp & "%0" & strChar
Else
strTemp = strTemp & "%" & strChar
End If
End If
Next
URLEncode = strTemp
End Function
Function URLDecode(ByVal What)
'URL decode Function
'2001 Antonin Foller, PSTRUH Software, http://www.motobit.com
Dim Pos, pPos
'replace + To Space
What = Replace(What, "+", " ")
on error resume Next
Dim Stream: Set Stream = CreateObject("ADODB.Stream")
If err = 0 Then 'URLDecode using ADODB.Stream, If possible
on error goto 0
Stream.Type = 2 'String
Stream.Open
'replace all %XX To character
Pos = InStr(1, What, "%")
pPos = 1
Do While Pos > 0
Stream.WriteText Mid(What, pPos, Pos - pPos) + _
Chr(CLng("&H" & Mid(What, Pos + 1, 2)))
pPos = Pos + 3
Pos = InStr(pPos, What, "%")
Loop
Stream.WriteText Mid(What, pPos)
'Read the text stream
Stream.Position = 0
URLDecode = Stream.ReadText
'Free resources
Stream.Close
Else 'URL decode using string concentation
on error goto 0
'UfUf, this is a little slow method.
'Do Not use it For data length over 100k
Pos = InStr(1, What, "%")
Do While Pos>0
What = Left(What, Pos-1) + _
Chr(Clng("&H" & Mid(What, Pos+1, 2))) + _
Mid(What, Pos+3)
Pos = InStr(Pos+1, What, "%")
Loop
URLDecode = What
End If
End Function
Dim MyArray, Msg
MyArray = Split(OriginalImagePath, "t=", -1, 1)
test = URLDecode(MyArray(1))
Dim Input
Input = InputBox("Enter new screenconnect computer name", ,test)
If Input = "" Then
Wscript.Echo "You entered nothing in the input box...quitting now"
wscript.quit
else
Input2 = URLEncode(Input)
newpathname = MyArray(0) & "t=" & Input2 & """"
'Wscript.Echo newpathname
strKeyPath = "SYSTEM\CurrentControlSet\services\" & temp
strValueName = "ImagePath"
strValue = newpathname
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
For Each objService in colServiceList
objService.StopService()
WSCript.Sleep 15000
objService.StartService()
next
end if
|