02-18-2007
06:27 PM
- last edited on
03-25-2019
07:34 PM
by
ciscomoderator
What is the best way to log out all users from EM?
This is required to update devices which cannot be done when users are logged in.
I have tried setting the forced logout after 5 mins, but this wont work if users are already logged in.
02-19-2007 05:46 AM
Try restarting the Tomcat service.
02-27-2007 12:46 PM
select name from device where loginTime > '0'
copy the MACs to a file
replace x.x.x.x with the IP of your Publisher
use AXL Browser(in the SDK) to to connect to your publisher, turn on Full Soap Logging. Get Person or whatever - you just need to make a SOAP request. Look in the logging window and cut the password - QWQDF1231AAF~! and paste it after Basic (overwrite "base64Password")
save file
run perl filename
#!perl
use CGI;
use LWP::UserAgent;
use HTTP::Headers;
use SOAP::Lite;
use IO::File;
my $deviceName;
my $axlRequest;
my $file="testOut.csv";
my $axlType;
my $host;
my $soapHeader;
my $soapFooter;
open (LOGIN,$file) or die print "$file could not be opened $!";
$axlType="doDeviceLogout";
$host = 'x.x.x.x:80';
$soapHeader="
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
";$soapFooter=" ";
while (
my $data=$_;
my @line = split(/,/,$data);
chomp @line;
foreach ($data){
$deviceName="
&axlSend;
}
}
sub axlSend{
$axlRequest="<>http://www.cisco.com/AXL/1.0\" xsi:schemaLocation=\"http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd\" sequence=\"10\">>
$deviceName
";
my $userAgent = LWP::UserAgent->new(agent => 'POST doDeviceLogout');
my $request="$soapHeader $axlRequest $soapFooter";
my $response = $userAgent->request(POST 'http://x.x.x.x/CCMApi/AXL/V1/soapisapi.dll',
Content_Type => 'text/xml',
Host => $host,
Authorization => 'Basic base64Password',
Content => $request);
#&html_header;
print $response->error_as_HTML unless $response->is_success;
$error=$response->as_string;
if (!$response->is_success){
print "Could not open connection to $host, $deviceName not logged off!";
}
elsif ($error=$response->as_string){
if ($error =~ /fault/){
print $response->error_as_HTML;
}
else { print "RESULT: logged out of $deviceName\n";
sleep(3);
}
}
}
&close_file;
#&html_footer;
sub html_header {
print "Content-type: text/html\n\n";
print "
print "
" |
02-27-2007 12:47 PM
do not remove the sleep statement - AXL cannot handle the requests running without it.
02-27-2007 12:48 PM
oh yeah, don't run it during production - AXL uses ~100% of the CPU during this process, actually AXL uses ~100 percent during any write activity.
02-27-2007 12:52 PM
If you run
select name, ikCurrentDeviceProfile, loginuserid from device where loginTime > '0'
put this in an excel spreadsheet - insert a new column after column 1 make the value 0 for all rows - save as .csv and this perl code will re-login all of your users.
Again, do not remove the sleep statement or run during production.
#!perl
## Author: Chris Harris
## Company: eLoyalty Corporation
use CGI;
use LWP::UserAgent;
use HTTP::Headers;
use SOAP::Lite;
use IO::File;
my $deviceName;
my $loginDuration;
my $profileID;
my $loginID;
my $axlRequest;
my $file="testOut.csv";
my $axlType;
my $host;
my $soapHeader;
my $soapFooter;
open (LOGIN,$file) or die print "$file could not be opened : $!";
$axlType="doDeviceLogin";
$host = 'x.x.x.x:80';
$soapHeader="
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
";$soapFooter=" ";
while (
my $data=$_;
my @line = split(/,/,$data);
chomp @line;
foreach ($data){
if ($line[0] =~ m/^SEP[a-z0-9](.+)/i && length $1=='12'){
$deviceName="
$loginDuration="
$profileID="
$loginID="
&axlSend;
}
else {print "$line[0] in Field 1 does not appear to contain a valid IP Phone MAC Address. Should be SEP + 12 digits" ; exit 0;}
}
}
sub axlSend{
$axlRequest="<>http://www.cisco.com/AXL/1.0\" xsi:schemaLocation=\"http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd\" sequence=\"10\">>
$deviceName
$loginDuration
$profileID
$loginID
";
my $userAgent = LWP::UserAgent->new(agent => 'doDeviceLogin');
my $request="$soapHeader $axlRequest $soapFooter";
## Use AXL Browser in IP Phone SDK with Full Soap logging to obtain Autorization String
my $response = $userAgent->request(POST 'http://x.x.x.x/CCMApi/AXL/V1/soapisapi.dll',
Content_Type => 'text/xml',
Host => $host,
Authorization => 'Basic base64Password',
Content => $request);
print $response->error_as_HTML unless $response->is_success;
$error=$response->as_string;
if (!$response->is_success){
print "Could not open connection to $host, $deviceName not logged off!";
}
elsif ($error=$response->as_string){
if ($error =~ /fault/){
print $response->error_as_HTML;
}
else { print "RESULT: $loginID logged into $deviceName\n";
sleep(3);
}
}
}
&close_file;
sub close_file{
close(LOGIN);
}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide