Link to home
Start Free TrialLog in
Avatar of Rick Rudolph
Rick RudolphFlag for United States of America

asked on

How would one write a Power Shell Script that would open a web page followed by two variables related to the current user and IP address?

I would like to create a power shell script that opens an html page followed by two variables.
The variables are:
Current Windows Domain User
Current Local IP address
I envision that the PSS would launch the default browser with
filename.html?Current Windows Domain User | Current Local IP address
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

Ok, so how are you wanting this script to run, Is it a login script, Are you running it remotely, Is this for a user to run?

Getting the variables is easy, what you're actually trying to do is a bit confusing.

Thanks
Alex

Avatar of Rick Rudolph

ASKER

I am having someone write a web page that will be used internally. We would like to pass some information to the web page as it is loading via variables. Specifically the user name and the ip address (the ip address tells us what subnet they are on.

So what I am thinking is that I create a powershell script, which launches the web page with the variables tacked on the end after a ? mark or however that should normally be done.

We would create a short cut on the desktops that launch the script

Hope that clarifies
Receiving parameters depends on the web page (HMTL etc. code). If you cannot put them into the URL, you need to fill out a form - and then it might get tricky.
OK, so you want to generate a link to a website which incorporates the IP and username.

What does the website do? Why does it need the variables passed over? I'm just thinking there would be a way to facilitate this for you.

Regards


If you cannot put them into the URL, you need to fill out a form - and then it might get tricky.              
I doubt that! Usually, you know the form parameters, so you're able to substitute/fill them and do a POST submit ;-)
You might doubt that, but I have done that on so many different web pages with a lot of effort and different approaches, so I don't take anything for granted anymore ;-).
Whatsoever, the web pages is self-controlled, so parameters in the URL should work fine.
The web page will be a series of buttons which will scan documents via an SDK which works with TWAIN compliant scanners.

This is a WAN environment with 40 locations on different subnets. The documents will be saved to a SAMBA partition on an RHEL LAMP server.

We could incorporate the authentication as well as the WAN side of the client, but I really want the LAN side IP, and I am not looking for user authentication, merely identification
You might doubt that, but I have done that on so many different web pages with a lot of effort and different approaches, so I don't take anything for granted anymore ;-).
https://davidhamann.de/2019/04/12/powershell-invoke-webrequest-by-example/
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial