Powershell: Running a .msc applet as another user -


i'm writing powershell script asks single set of admin credentials, , uses run relevant applications, pulled network-hosted csv. when try run

start-process $tools[$userinput-1].path.tostring() -credential $credential 

(where $tools returning "c:\program files\microsoft\exchange server\v14\bin\exchange management console.msc") error below

start-process : command cannot executed because input "c:\program files\microsoft\exchange server\v14\bin\exchange management console.msc" invalid application.  give valid application , run command again. @ line:1 char:14 + start-process <<<<  "c:\program files\microsoft\exchange server\v14\bin\exchange management console.msc" -credential get-credential     + categoryinfo          : invalidoperation: (:) [start-process], invalidoperationexception     + fullyqualifiederrorid : invalidoperationexception,microsoft.powershell.commands.startprocesscommand 

if need to, i'll write .bat file , run that, i'd rather avoid whenever possible.

and reason i'm not using invoke-item because can't take -credential, if man file says otherwise.

.msc saved console file, host of mmc, start powershell use syntax similar following:

$mmcpath = "c:\windows\system32\mmc.exe" $mscpath = "c:\program files\microsoft\exchange server\v14\bin\exchange management console.msc" start-process -filepath $mmcpath -argumentlist $mscpath 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -