ShoreTel

From WikiWiki
Jump to: navigation, search

Log-in / log-out script

$server="127.0.0.1"
$port="5440"
$domain="domainname"
$username="username"
$userlen=$domain.length + $username.length + 1
$passwd="password"
$extension="478"
$extlen=$extension.length

#get id
$request = [System.Net.WebRequest]::Create("http://$server`:$port/CSIS/CSISISAPI.dll/?request?00000000-0000-0000-0000-000000000000;CCSISSvrCONN`:`:connectX;$userlen;$domain\$username;$extlen;$extension")
$response = $request.GetResponse()
$responsestream = $response.GetResponseStream()

$sr = new-object System.IO.StreamReader $responsestream
$result = $sr.ReadToEnd()
$id=$result.Substring(17,36)

#get state
$request3 = [System.Net.WebRequest]::Create("http://$server`:$port/CSIS/CSISISAPI.dll/?request?$id;CCSISSvrCFG::getWorkgroupAgentStatus;$extlen;$extension;1;")
$response3 = $request3.GetResponse()
$responsestream3 = $response3.GetResponseStream()

$sr3 = new-object System.IO.StreamReader $responsestream3
$result3 = $sr3.ReadToEnd()
$id3=$result3.Substring(16,1)



#set state
$request2 = [System.Net.WebRequest]::Create("http://$server`:$port/CSIS/CSISISAPI.dll/?request?$id;CCSISSvrCFG`:`:setWorkgroupAgentStatus;$extlen;$extension;1;$action")
$response2 = $request2.GetResponse()
$response2.Close()