Operating system: Windows 2019
PowerShell version(s): 6
I use a GUI which starts with a runas account.
I have a button that calls explorer.exe. I have already tried a variety of ways, however the explorer does not open.
I have already tested the following alternatives:
(PopUp: I have a function that opens a message window)
Code: Select all
$Button_Click = {
try
{
ii c:\Windows\explorer.exe "\\Server\Share$\"
}
catch
{
PopUp -Text "$($_.Exception.Message) `r`n $($_.Exception.ItemName) " -Titel "Warning"
}
Code: Select all
$OpenFileDialog = New-Object System.Windows.Forms.FolderBrowserDialog
$OpenFileDialog.SelectedPath = "\\Server\Share$\"
$OpenFileDialog.ShowDialog() | Out-Null
Code: Select all
net use "\\Server\Share$\"
explorer.exe "\\Server\Share$\"
Code: Select all
$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = "explorer.exe"
$startinfo.WorkingDirectory = "\\Server\Share$\"
[System.Diagnostics.Process]::Start($startinfo)
As a solution I thought: Hey just start the explorer under the currently logged in user.
But then I found the article below: viewtopic.php?t=8868 .
Is there any way to implement this?