Verb RunAs in a Start-Process Powershell command causes an error

Hi again all :wave:

I’ve been trying for 2 days to deal with what looks like a small problem but I can’t find any solution :frowning:
I need to run my Active Directory which works fine when I double click on it → Run as administrator ; BUT if I try to automatically load with a PS script :
Start-Process -FilePath “C:\Windows\system32\dsa.msc” -Verb “RunAs” Powershell
It shows me the message
PowerShell : -verb : The term ‘-verb’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check
At line:1 char:1

  • PowerShell -verb runas
  •   + CategoryInfo          : NotSpecified: (-verb : The ter...program. Check :String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • -verb runas
  •   + CategoryInfo          : ObjectNotFound: (-verb:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

I searched the internet / googled etc… but no solution worked for me :frowning:

Anbody?

Since dsa.msc is not an executable the proper command should actually be this:

Start-Process -FilePath 'C:\WINDOWS\system32\mmc.exe' -ArgumentList 'C:\Windows\system32\dsa.msc' -Verb RunAs

Try it this way

Please when you post code or error messages format it as code using the preformatted text button ( </> ). Otherwise the forum software will mess up you code and error messages.

Thanks in advance

Hi Olaf :slight_smile: :wave:

Your fixed command DID opened the Active Directory console BUT without admin rights
Maybe I confuse or gave you wrong information: ot deails so I’ll try to fix the information:
I am trying to “automate” the opening of my AD (meaning: instead of opening it with SHIFT + Left mouse key) . I mean to cdouble click on it and open it immiedily .


ith admin. It is an excuse to practice “PowerShell for begginers”
BTW after i used your script the line still greyed out which indicated that I still have no admin rights :frowning:

Just to mention that at least once … you know you don’t need a PowerShell script for that, don’t you?

You do realize that if you open a PowherShell window with “Run as Administrator”, you simply need to enter “dsa.msc” to open with admin?

I only mention this because I see a PowerShell window in your screen shot. Seems like the simplest thing to do to me.

OK Thnaks. I did know THIS thing. but I DID KNOW that mouse left click + shift -->> Run as administrator is as good as your suggestion. Holwever - I Just wanted to “create” a simpe program that I will double click on it adn it will open my AD as admin. Just to practise … Never mind ; I am letting it go
Thank you any way :slight_smile: