internet explorer - PowerShell script to launch 4 IE windows using different AD account credentials -
why won't simple powershell script launch 4 ie windows using different ad account credentials embedded script?
$users = ('testaccount1','testaccount2','testaccount3','testaccount4') $password = 'password' foreach ($user in $users) { $username = ('domainname\' + $user) write-host $username $cred = new-object system.management.automation.pscredential -argumentlist @($username,(convertto-securestring -string $password -asplaintext -force)) start-process -filepath "c:\program files\internet explorer\iexplore.exe" -loaduserprofile -credential $cred -argumentlist "http://websiteaddress.com" }
when run it, error, ie file path correct:
domainname\testaccount1 start-process : command cannot run due error: directory name invalid. @ c:\users\username\downloads\launch ie multiple users testing.ps1:12 char:2 + start-process -filepath "c:\program files\internet explorer\iexplore.exe" -load ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [start-process], invalidoperationexception + fullyqualifiederrorid : invalidoperationexception,microsoft.powershell.commands.startprocesscommand
can please explain why above script gives error? i'm using powershell 3.
note: line launch ie & go specified website url know ie file path & directory name valid:
start-process -filepath "c:\program files\internet explorer\iexplore.exe " "http://www.google.com"
Comments
Post a Comment