Make sure that the default admin$ share is enable on ServerName
Asked Answered
W

3

14

When running the psexec command to remotely install or execute something on a sever on the same network the following error was displayed.

Couldn't access ServerName

The network name cannot be found

Make sure that the default admin$ share is enable on ServerName

Most references suggested that you add the following to the registry, but in my case this was already added to the server. This did not resolve the issue.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System and create or modify a REG_DWORD value LocalAccountTokenFilterPolicy and set its value to 1

Winery answered 22/8, 2013 at 18:39 Comment(1)
#15907036Petrify
W
17

Solution:

You need to add the 'admin$' share which is your C:\Windows location.

  1. Go to C:\windows and right-click --> Properties
  2. Hit advance sharing
  3. Click the check box Share this folder
  4. Enter the name admin$ and hit Permissions
  5. I would recommend removing 'Everyone' and adding just the users that the PsExec command will use to execute.

Run the PsExec command again and this should resolve your issue.

Edit:

You can also turn on your AutoShareServer in the registry, which will automatically create the admin shares.

  1. Start regisry regedit
  2. Search for key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\AutoShareServer
  3. Change the AutoShareServer key to 1
Winery answered 22/8, 2013 at 18:42 Comment(4)
while giving share name as admin$ it is throwing error as reserved names!Petrify
Another solution is to turn on your Auto Share Server setting in the registry. See edited AnswerWinery
The server I'm working on (AWS EC2 Win2016) does not have that key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Hanukkah
A Windows 10 1903 VM didn't like option 1. When I went back and looked it says the directory was not shared.Univalence
A
3

You can also enable amins$ share by enabling File and Printer Sharing (SMB-In) Firewall Rule.

Go to Control Panel > System ans Security > Windows Defender Firewall > Advance Settings > Inbound Rules. Right click on File and Printer Sharing (SMB-In) from the list and select Enable Rule`. Normally, there are two File and Printer Sharing (SMB-In), one is for Domain profile and one is for Public & Private profile. I'm not sure which profile should be applied, Domain or Public or Private. For me, it's Domain profile.

Artemas answered 8/11, 2018 at 9:54 Comment(0)
H
1

In my case it was a network problem like mentioned in the error message.

I needed to allow SMB traffic on port 445 on the target machine. PSExec worked straight away after adding the firewall rule to allow that traffic.

Hanukkah answered 6/6, 2019 at 12:8 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.