Solved

powershell help

Posted on 2016-07-28
6
52 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
ID: 41733866
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
ID: 41733869
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 19

Expert Comment

by:Peter Hutchison
ID: 41733877
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
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 
LVL 5

Expert Comment

by:Eric C
ID: 41733900
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
ID: 41733905
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
ID: 41734641
Thank you it worked
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
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…

863 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

19 Experts available now in Live!

Get 1:1 Help Now