E
E
etoosamoe2018-01-12 08:04:38
PowerShell
etoosamoe, 2018-01-12 08:04:38

Opening a c$ computer on the network on behalf of another user?

Greetings!
In work, you often have to go to the computers of other users, according to the scheme Win + E -> Ctrl + L (to highlight the address bar) -> \\*computer_name*\c$ -> login-password of an account with admin rights.
I wanted to try to reduce the number of actions, before opening a bat or ps1 script and entering the name of the computer, then the explorer window would open with "c $" under the admin account.
As it turned out, everything is not so simple - in cmd, no
runas /user:domain:user explorer.exe /separate "\\comp_name\c$"
start "" "\\comp_name\c$
" rolled with ii "comp_name\c$"
Tell me which way to look? Maybe there is a suitable software (as an option, of course, Total Commander launched from the admin, but I would like to use standard Windows tools so as not to produce a lot of programs).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Grishin, 2018-01-12
@vesper-bot

The usual net use, from the new-psdrive powershell with credits, or runas /user:domain\user powershell.exe /command "new-psdrive -persist (other parameters)". Maybe that's enough?

R
res2001, 2018-01-12
@res2001

In general, explorer should ask for a username/password when connecting to a remote resource. It does not request them if it was able to connect to a resource with current rights.
But you can force it to use non-current credentials - using a password manager. In the password manager, you need to create entries for accessing remote computers. Then the stored credentials will be used when navigating to the remote resource normally. To work with the password manager, there is a command line utility (cmdkey) - you can automate the process of creating credentials.
With a large number of remote computers, this is not convenient.
Personally, I used Far running with administrator rights of remote workstations (this user did not have administrator rights on my machine). In my opinion, it is impossible to launch explorer under another user without leaving your session. Explorer as a file manager is not the best choice, IMHO. I have been using Far for a long time and I always have it installed.

A
azarij, 2018-01-12
@azarij

what if ii "\\compname\C$" ?
and your user has admin rights on the remote machine?
if not:
$Username = 'user'
$Password = 'pass'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass
ii "\ \compname\C$" -credential $cred
or add your user to the local admins group on all remote machines and there will be no need to fence the garden with credentials.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question