I am writing a solution for users to open a file, and this file should go to a specific site and insert the username in the login form. This file should be available to users who are in a citrix session .
This should be extremely simple, and I discovered a way to do this through Powershell:
$aduser = Get-ADUser $env:USERNAME -Properties EmailAddress
$emailaddress = $aduser.EmailAddress
$url = "https://website.org/loginpage.asp"
$ie = New-Object -comobject "InternetExplorer.Application"
$ie.visible = $true
$ie.Navigate($url)
WaitForPage 10
$ie.Document.GetElementById("USERID").Value = $emailaddress
This works great - it opens a web page and inserts a username (email address).
However, when a user launches this from their machine, it seems impossible to hide the CMD window (if it works from .cmdor .bat), as well as the Powershell window. -WindowStyle Hiddenjust reduced the time the window appears - this is not an acceptable solution.
, , # exe ( - ). - #, (, Selenium, , ).
, , Powershell script #? -comobject script .NET, , #?
- .ps1 ( CMD):
START Powershell.exe -WindowStyle Hidden -File \\file\Folder\SK\scripts\powershell\opensite.ps1
. , #.