hi all,
here's the situation:
I'm writing a GUI to help the service desk in their daily tasks. For that purpose, I need to open an explorer window on a given path on a target computer. If I use invoke-item on the path, the user needs to enter his/her credentials each time they access a new computer, which I'm trying to get rid of.
It looks like this would fix the creds issue:
$creds = get-credential
new-psdrive -psprovider filesystem -name myPSDrive -root \\computer_name\c$\path_needed
invoke explorer here <<<--- not working as needed
remove-psdrive -name myPSDrive
But then, I am unable to open a windows explorer on that given path. Whenever I open explorer, I'm at the default path of it, not the path that I wish to display.
How can I do what I need?
Sorry if this is not clear enough.
Thanks
open explorer with path
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: open explorer with path
That will happen if you don't have permission on the path or some part of the path.Domtar wrote: ↑Fri Sep 16, 2022 6:04 am hi all,
here's the situation:
I'm writing a GUI to help the service desk in their daily tasks. For that purpose, I need to open an explorer window on a given path on a target computer. If I use invoke-item on the path, the user needs to enter his/her credentials each time they access a new computer, which I'm trying to get rid of.
It looks like this would fix the creds issue:
$creds = get-credential
new-psdrive -psprovider filesystem -name myPSDrive -root \\computer_name\c$\path_needed
invoke explorer here <<<--- not working as needed
remove-psdrive -name myPSDrive
But then, I am unable to open a windows explorer on that given path. Whenever I open explorer, I'm at the default path of it, not the path that I wish to display.
How can I do what I need?
Sorry if this is not clear enough.
Thanks
Why are you creating a "cred" object? Maybe you copied that line by mistake?
Re: open explorer with path
I need the credential object because my GUI is used by the Service Desk to browse files on a targeted computer, to see installation log files and such...
if I use &explorer <path> as suggested by owinsloe, the credential window pops up. since a resource from the service desk can access tens of computers in a day, i'm trying to get rid of them having to enter their creds each time they browse a new computer.
anyway, can someone please suggest a way to do what i need? i need a way to access multiple computers without having to enter my creds for each new pc.
my tool has many options, 2 of them are to be able to open MSI log files & SCCM log files. the user of this tool needs to connect to:
\\computer1\c$\windows\ccmlogs
\\computer2\c$\windows\msilogs
etc...
thanks!
if I use &explorer <path> as suggested by owinsloe, the credential window pops up. since a resource from the service desk can access tens of computers in a day, i'm trying to get rid of them having to enter their creds each time they browse a new computer.
anyway, can someone please suggest a way to do what i need? i need a way to access multiple computers without having to enter my creds for each new pc.
my tool has many options, 2 of them are to be able to open MSI log files & SCCM log files. the user of this tool needs to connect to:
\\computer1\c$\windows\ccmlogs
\\computer2\c$\windows\msilogs
etc...
thanks!
Re: open explorer with path
This is not a scripting issue. Just add an AD group to all of the folders via Group Policy then add anyone who needs access to the group. Do this once and you have control of who has access by just adding or removing them from the group.
This also eliminates divulging account names and passwords to hackers.
This also eliminates divulging account names and passwords to hackers.
Re: open explorer with path
we already have an AD group that does that. each user is a member of that group. the user name / password is not written anywhere so there is 0 risk for a hacker to get those.
does this mean that you cannot help me resolving my issue?
does this mean that you cannot help me resolving my issue?
Re: open explorer with path
If you have the group, then why do you need to use another account. Just put all users that need access to teh log files in the group.
I think you should start by asking your company security officer and AD people how to get you set up. It is necessary to work with someone who is trained fully in Windows AD networking.
You can also just map a drive to the server, and you will have the access you want.
As far as how to use PowerShell for accessing remote resources here is a free book that will get you up to speed.
https://www.sapien.com/books_training/W ... werShell-4
The command you want is "Get-PsDrive". YOU can get help on any PC command and all syntax elements with the built-in help system which the book shows you how to use.
help Get-PsDrive -full
The help has the examples. Be sure you have completed the PowerShell install and initialization including installing the help documentation. YOU may have security issues if the security on your site has restricted PS security.
I think you should start by asking your company security officer and AD people how to get you set up. It is necessary to work with someone who is trained fully in Windows AD networking.
You can also just map a drive to the server, and you will have the access you want.
As far as how to use PowerShell for accessing remote resources here is a free book that will get you up to speed.
https://www.sapien.com/books_training/W ... werShell-4
The command you want is "Get-PsDrive". YOU can get help on any PC command and all syntax elements with the built-in help system which the book shows you how to use.
help Get-PsDrive -full
The help has the examples. Be sure you have completed the PowerShell install and initialization including installing the help documentation. YOU may have security issues if the security on your site has restricted PS security.
Re: open explorer with path
ok, let's take this from scratch.
the GUI is started with the same user that needs to browse the logs. There is no other user account.
if you look at the first post, I did say I'm trying to use new-psdrive & get-psdrive
but when i run get-psdrive with the path i need, it is asking my for credentials. I'm trying to get rid of that credential request.
the GUI is started with the same user that needs to browse the logs. There is no other user account.
if you look at the first post, I did say I'm trying to use new-psdrive & get-psdrive
but when i run get-psdrive with the path i need, it is asking my for credentials. I'm trying to get rid of that credential request.
jvierra wrote: ↑Tue Oct 04, 2022 5:03 am If you have the group, then why do you need to use another account. Just put all users that need access to teh log files in the group.
I think you should start by asking your company security officer and AD people how to get you set up. It is necessary to work with someone who is trained fully in Windows AD networking.
You can also just map a drive to the server, and you will have the access you want.
As far as how to use PowerShell for accessing remote resources here is a free book that will get you up to speed.
https://www.sapien.com/books_training/W ... werShell-4
The command you want is "Get-PsDrive". YOU can get help on any PC command and all syntax elements with the built-in help system which the book shows you how to use.
help Get-PsDrive -full
The help has the examples. Be sure you have completed the PowerShell install and initialization including installing the help documentation. YOU may have security issues if the security on your site has restricted PS security.
Re: open explorer with path
OK i found this and it works.
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = "\\$($comboPCName.Text)\c$\windows\msi\logs"
$OpenFileDialog.filter = "All files (*.*)| *.*"
$OpenFileDialog.ShowDialog() | Out-Null
thanks!
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = "\\$($comboPCName.Text)\c$\windows\msi\logs"
$OpenFileDialog.filter = "All files (*.*)| *.*"
$OpenFileDialog.ShowDialog() | Out-Null
thanks!