GOAL
Remotely access from a machine to another, using psexec, in order to start/stop a net service.
CONFIGURATION
ISSUE
Couldn't access MACHINE_IP:
Access denied.
PREMISE
WHAT I'VE TRIED
The first attempt was quite simple; so, from A, I ran:
psexec \\B_IP -u B_ADMIN_NAME -p B_ADMIN_PWD net stop SERVICE_NAME
but, as a result, I got the "Access denied" error. Searching for the issue, I've found a lot of possible solutions but, unfortunately, noone worked for me. Here's what I tryied:
cmdkey.exe /add:B_IP /user:B_IP\B_ADMIN_NAME /pass:B_ADMIN_PWD
net use \\B_IP\ipc$ /user:B_ADMIN_NAME B_ADMIN_PWD
runas /user:B_ADMIN_NAME "psexec -e -h -s -u B_ADMIN_NAME -p B_ADMIN_PWD \\B_IP cmd /C net stop SERVICE_NAME"
Another strange thing is that A cannot access to B via filesharing. To be precise, it can access to \\B_IP but not to \\B_IP\C$ nor \\B_IP\ADMIN$.
I think those two issues (access denied with psexec and filesharing) are somehow related but, as I said, noone of the previous solutions worked for me.
Any other ideas would be very appreciated.
Thanks.
IIRC the admin$ share uses SMB1/CIFS which 1709 or 1803 automatically disabled because MS considers SMB1 not secure enough. (If you're using a samba server and your windows client cannot access network shares anymore after upgrading to one of these versions, the answer below should also work for you)
It has to be manually reactivated through "turn windows features on or off" full name : SMB 1.0/CIFS File Sharing Support. Be aware that this feature contains both client and server, be sure to expand the feature's tree to check if you correctly install the one you need (server for psexec, client for network shares)