Solved

powershell help

Posted on 2016-07-28
6
66 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
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 13

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…

726 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