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
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$
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
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
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.SelectedPath = "\Servernamehere\c$"
$OpenFileDialog.ShowDialog() | Out-Null