2

The Context: Powershell launched as a domain admin.

From this Powershell window, Is it possible to open c$ of a remote box (\server\c$) in explorer.exe without asking for credential (using the current credential) ?

Thanks

4 Answers 4

5

Yes, if you cd into \\server\c$ you can run invoke-item on the current directory.

cd \\server\c$
ii .

Or you can invoke the directory directly

invoke-item \\server\c$
1
  • Thanks Andy! But it does not work from a powershell (launched as domain admin in my case)
    – Xavier C
    Dec 9, 2009 at 20:15
1

I found the solution:

Thanks for your help Andy.

I found the solution, reading this article from windowsitpro.com

I had to modify a key in the register of the domain admin profile on my workstation. Since i'm not the only admin in my company, I included the key modification in my script. And i'm not asked for credential! Beautiful! Here you go:

$RegKey ="HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\advanced"
$user = $env:username
$domain = $env:userdomain
set-ItemProperty -path $RegKey -name SeparateProcess -value 1
net use \\$args\c$ /user:$domain\$user
explorer.exe \\$args\c$

I used net use, but there are many ways to do this, for example you can also use RUN AS

runas /user:domain\username explorer.exe

Hope that's help

0

I know this is an old thread, but for anyone else coming across it... might I suggest

$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = "\\Servernamehere\c$"
$OpenFileDialog.filter = "All files (*.*)| *.*"
$OpenFileDialog.ShowDialog() | Out-Null

the out-null bit just stops it writing a line of output to the console

0

$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.SelectedPath = "\Servernamehere\c$"

$OpenFileDialog.ShowDialog() | Out-Null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .