strange issue with new Win 10 computers and elevating explorer.exe

Hi I have a strange issue with new Win 10 computers and elevating explorer.exe with my administrative account. I created a powershell app that serves as a menu system to launch other powershell apps with my admin id. So for example I set the admin credential with the following:

$global:cred = Get-Credential -Credential ‘Domain1’

Then start another app from the menu with the following example:

Start-Process “C:\Program Files\DesktopPowershellAPPS\Computer Support.exe” -Credential $cred

The Computer Support.exe then runs as my admin account. Everything works except when I try to do an admin share to the c: drive of a remote computer. It starts explorer.exe as my regular id that I’m logged into the computer with not my admin account. Here’s the simple code for the admin share:

$computername = $textboxCN.text.Trim()
$files = “\” + $computername + “\c$”
Start-Process explorer.exe $files

This is working on some of the Win 10 computers but not others. I’m stumped. Any ideas to get it to run as intended with the admin id?
Thanks for any help in advance.

$computername = $textboxCN.text.Trim() $files = "\\" + $computername + "\c$" Start-Process explorer.exe $files
Is this part accurate? If so, you're not passing the credential object to Start-Process, so it'll default to launching with whatever account is running the script.

Yes it is but the computer support.exe application is running under my admin account so it should launch explorer.exe with the admin account. It does with some Win 10 computers and are working fine. Is there a better way to script this?

$computername = $textboxCN.text.Trim()
$files = “\” + $computername + “\c$”
Start-Process explorer.exe $files

Thanks

You could try -Verb parameter and pass RunAs as value to it.

Eg:- Start-Process PowerShell -Verb RunAs

Most likely related to the same issue in which you can’t elevate explorer.exe at runtime in a user session.
As far as I know you would need to kill the your explorer.exe process first and then launch it again from e.g. command prompt.

It’s the same reason you’ll get UAC prompts if you try to access a folder locally where the folder permissions don’t allow you by default to access the folder.

There is possibly workarounds for it but explorer.exe is tricky to do fancy stuff with.

Good news is I figured it out. It turns out it is the following:

HKCR\AppID\ {CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}

Ownership needs to be changed to administrators and then the runas key located here needs to be deleted or renamed.

We had this since Windows 7 and for whatever it was missed in some of the Win 10 configurations. I hope this helps out other people.