We help IT Professionals succeed at work.
Troubleshooting Question

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?

39 Views
Last Modified: 2020-09-15
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
Comment
Watch Question

AlexA lack of information provides a lack of a decent solution.
CERTIFIED EXPERT

Commented:
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

Rick RudolphPresident

Author

Commented:
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
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
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.
Alex [***Alex140181***]Software Developer
CERTIFIED EXPERT

Commented:
AlexA lack of information provides a lack of a decent solution.
CERTIFIED EXPERT

Commented:
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


Alex [***Alex140181***]Software Developer
CERTIFIED EXPERT

Commented:
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 ;-)
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
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.
Rick RudolphPresident

Author

Commented:
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
Alex [***Alex140181***]Software Developer
CERTIFIED EXPERT

Commented:
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/
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.