Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Real time display autolauch (Powershell)

Status
Not open for further replies.

tobywan

Technical User
Jun 20, 2007
8
DK
Hi guys,

We have alot of real time displays across our callcenters. Im working on a better solotion, when our support team needs to restart a display which takes some time (login, menu, browse etc).

I would like to base this on powershell. I havent done that much powershell, so thought this would be a good way learn abit more :)

This is what I have come up with so far. If I can get it to work I will add a simple gui later on.


<# Browser version must be IE or I will be redirected away from login site#>
$userAgent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT; Windows NT 6.1; en-US)'

<# CCMA server login page#>
$baseUrl = "
<# Link to real time display#>
$displayURL = "
<# login process #>
$url = Invoke-WebRequest $baseUrl -SessionVariable ccmalogin -UserAgent $userAgent
$url.Forms[0].fields["UserID"] = "my display user"
$url.Forms[0].fields["Password"] = "my display password"
$result = Invoke-WebRequest $baseUrl -WebSession $ccmalogin -UserAgent $userAgent -Body $url -Method Post

<# start display #>
start $displayURL

Right now I have the following issues.

If I do a MANUAL login from the ccma website and run my script, it will launch the correct display.
If I run the script without a working running session, it will just launch the CCMA login site.
Something must be wrong with my login request then :)

Im getting a active X promt when running the script. Manual launch does not give this. I can click OK and it the loginsite will launch

Any obvious errors?
 
ok, I got the authentication part working now :)
 
Yes of course. I was in a rush yesterday.

This script will login to the ccma website

$request = Invoke-WebRequest -uri ' -UserAgent 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT; Windows NT 6.1; en-US)' -SessionVariable ccmalogin
$loginForm = $request.Forms
$request.Forms[0].fields["UserID"] = "display user"
$request.Forms[0].fields["Password"] = "display password"

$r = Invoke-WebRequest -uri ' -WebSession $ccmalogin -Method Post -Body $loginForm.Fields


However it doesnt look like its possible to convert a PS memory session to Internet Explorer. Even if my user is authenticated and logged in I get the login window when launching a browser from my script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top