1

I am trying to create a Simple (or so i thought) at startup Script for my Work Machine.

For this i need to mainly open

IE Firefox as logged in user Firefox as Admin user Outlook as main profile

I'm looking to do this with Powershell - any ideas on how to achieve the running as admin user for Firefox as I have managed to get the rest working.

4
  • You need to show your existing code if you want some help. Jun 25, 2014 at 19:46
  • I have been using Shortcuts whilest making use of the Runas Command For example 'code' "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote and C:\Windows\System32\runas.exe /user:Domain\User2 "C:\Program Files\Mozilla Firefox\firefox.exe -no-remote" 'code' Jun 25, 2014 at 20:04
  • You can configure a shortcut to use Runas by default in the Advanced Properties. Jun 25, 2014 at 20:07
  • I have managed to create a shortcut to do this - Was ok for when i needed to open only 1 item but now i'm looking at having 3 instances of Firefox open at one time ( all as different users) but i cannot get the no-remote parameter to function as well Jun 25, 2014 at 20:09

2 Answers 2

2

You need to create a credentials object with the proper ones in it, and then run the app you want with it like this:

$username = "username"
$password = "password"
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))

Start-Process filefullpath.exe -WorkingDirectory path_here -Credential ($credentials)

Got it from here.

7
  • I have been using the above but cannot push the parameter "no-remote" along with this as well Jun 25, 2014 at 20:10
  • What's "no-remote"? couldn't find anything about it.
    – EliadTech
    Jun 25, 2014 at 20:45
  • No-Remote is the Firefox parameter that forces each new instance of firefox to open as a seperate process - otherwise you open firefox with User1 then try open it with user2 and it just opens a new Window as User1 Jun 26, 2014 at 9:07
  • Than just add it to "start-process" with "-ArgumentList". Can't test at the moment, I'll try later today.
    – EliadTech
    Jun 26, 2014 at 9:13
  • I have been trying this yet When i Run it All i see happen is that a new tab in the current window appears - where this should force a new Window to Appear instead Jun 26, 2014 at 17:50
-1

My script is as follows

This would be run by DOMAIN\User1

$username1 = "Domain\user2"
$username2 = "Domain\User1_adm"
$password = "Passw0rd!"
$credentials1 = New-Object System.Management.Automation.PSCredential -ArgumentList    @($username1,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$credentials2 = New-Object System.Management.Automation.PSCredential -ArgumentList @($username2,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$Args1 = "-no-remote"
$Args2 = "no-merge"

Start-Process "C:\Program Files\Mozilla Firefox\firefox.exe" -ArgumentList $Args1 -Credential ($credentials1)
Start-Process "C:\Program Files\Mozilla Firefox\firefox.exe" -ArgumentList $Args1 -Credential ($credentials2)
Start-Process "C:\Program Files\Mozilla Firefox\firefox.exe"
Start-Process "iexplore.exe" -ArgumentList $Args2 -Credential ($credentials1)
Start-Process "iexplore.exe" -ArgumentList $Args2 -Credential ($credentials2)
Start-Process "iexplore.exe" -ArgumentList $Args2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .