Solved

powershell help

Posted on 2016-07-28
6
46 Views
1 Endorsement
Last Modified: 2016-07-29
Start-Process -FilePath "C:\Program Files\Internet Explorer\iexplore.exe " "http://www.google.com" -Credential (Get-Credential)

getting the following error

Start-Process : This command cannot be run due to the error: The directory name is invalid.
At line:1 char:1
+ Start-Process -FilePath "C:\Program Files\Internet Explorer\iexplore.exe " "http ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
1
Comment
Question by:Jorge Ocampo
6 Comments
 
LVL 5

Expert Comment

by:Eric C
Comment Utility
On that computer, press Windows-R to bring up the 'Run' dialog box.

Copy and paste in this command:
   C:\Program Files\Internet Explorer\iexplore.exe
Press Enter

Does Internet Explorer launch?
If not, then that's the problem.
0
 
LVL 2

Author Comment

by:Jorge Ocampo
Comment Utility
yea it does run, it even runs with the following

Start-Process -FilePath "C:\Program Files\Internet Explorer\iexplore.exe " "http://www.google.com"

only problem is the credentials part
0
 
LVL 18

Expert Comment

by:Peter Hutchison
Comment Utility
Try changing the Execution Policy from the default to Remote Signed:
Set-ExecutionPolicy RemoteSigned

Also try changing your command to use single quotes for the url
Start-Process -FilePath "C:\Program Files\Internet Explorer\iexplore.exe " 'http://www.google.com'
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 5

Expert Comment

by:Eric C
Comment Utility
what happens if you remove the quotes from around "http://www.google.com" altogether ?
0
 
LVL 12

Accepted Solution

by:
Dustin Saunders earned 500 total points
Comment Utility
You have to include the working directory if impersonating a user in c#/Powershell.  Try:

Start-Process -FilePath "C:\Program Files\Internet Explorer\iexplore.exe" "www.google.com" -Credential (Get-Credential) -WorkingDirectory "C:\Program Files\Internet Explorer\"

Open in new window


*edit - I had taken out the www.google.com, put it back in.
1
 
LVL 2

Author Closing Comment

by:Jorge Ocampo
Comment Utility
Thank you it worked
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now