Create web report user via the query http Get

(imported topic written by SystemAdmin)

I am trying to create a user for web report through the query http get, i use the following, and BigFix version 7.2:

http://webReportServerIP:webReportServerPort/webreports?Username=webReportLogin&Password=webReportPassword&page=AdministerUsers&NewUserUsername=theUserName&NewUserPassword=thePassword&NewUserPassword2=thePassword&UserClass=consolefilter&ConsoleUser=theUserName&newUserFormSubmit=1

I always have this error message “Your session has expired.Please refresh the page and try again.” could anyone help with this?

(imported comment written by BenKus)

Not sure… Maybe Leland’s trick will work for you?

http://forum.bigfix.com/viewtopic.php?id=1450

Ben

(imported comment written by SystemAdmin)

Thanks Ben for your reply, but i was trying to CREATE a user through this link:

http://webReportServerIP:webReportServerPort/webreports?Username=webReportLogin&Password=webReportPassword&page=AdministerUsers&NewUserUsername=theUserName&NewUserPassword=thePassword&NewUserPassword2=thePassword&UserClass=consolefilter&ConsoleUser=theUserName&newUserFormSubmit=1

Is it working? i tried even to choose another option like UserClass=admin or normal, but it gives the same error! so i think there is a problem with the last part starting from UserClass…

(imported comment written by SystemAdmin)

Ben hello again,

This is just to confirm that i tried what you suggest about the fwdpage, and it gives the same error…

(imported comment written by BenKus)

Hi Marie,

As a security measure in BigFix 7.0+, there is an “AdminToken” that will change in each session and it must be used to create users. So to create users automatically through a script, you will need to parse out the AdminToken… Here is an example from one of our developers of how to do this in PERL:

use warnings; use strict; use LWP::Simple; use LWP::UserAgent;   my $browser = LWP::UserAgent->

new; my $admin_token;   # Login and get the administrator token my $login_url = 
"http://localhost:80/webreports?Username=admin&Password=bigfix&page=AdministerUsers"; my $response = $browser->get( $login_url );   

if ( $response->content =~ /name=\
"AdminToken\" value=\"(.*)\"/) { $admin_token = $1;   
} 

else 
{ die 
"Could not extract administrator token"
}   $response=
"";   my $create_url =”http:
//localhost/webreports?Username=admin&Password=bigfix&page=AdministerUsers&NewUserUsername=user1&NewUserPassword=bigfix&NewUserPassword2=bigfix&UserClass=consolefilter&ConsoleUser=user1&AdminToken=$admin_token&newUserFormSubmit=1"; $response = $browser->get( $create_url ); die 
"Can't get $create_url -- ", $response->status_line unless $response->is_success;

Hopefully that helps,

Ben

(imported comment written by arnaud91)

Hi,

the same code, in vbscript:

Set ie = CreateObject(
"internetexplorer.application") ie.Visible = 

false ie.Navigate (
"http://bes-srv.demo.loc:52312/webreports?Username=admin&Password=bigfix&page=AdministerUsers")   Do While ie.Busy wscript.sleep (100) Loop wscript.sleep (2000)   token = ie.document.getElementByID(
"AdminToken").value   createURL = 
"http://bes-srv.demo.loc:52312/webreports?Username=admin&Password=bigfix&page=AdministerUsers&NewUserUsername=user1&NewUserPassword=bigfix&NewUserPassword2=bigfix&UserClass=consolefilter&ConsoleUser=user1&AdminToken=" & token & 
"&newUserFormSubmit=1" ie.Navigate (createURL)

Arnaud