I am using the NPM package windows-network-drive
to map a network drive to my windows system. Normally I would pass in undefined for the username and password because I do not need to use different credentials, but when I do this in a windows service, which I mounted through the node-windows npm package, the drive is not mounted and I assume this is because it does not have the credentials, so I then therefor passed in the username and password into the network drive mount. This causes the drive to be mounted, but it says Disconnected Network Drive (J:)
TLDR; Drive is mounting when used with node command but not in windows service.
I have tried
- using default credentials
- passing in the username and password into the mount
- running using node command in terminal (Which works, but does not work as a service)
My code is (with changed username, password, and server):
let networkDrive = require("windows-network-drive");
networkDrive.mount(
`\\\\192.168.1.1/subdir`,
undefined,
"username",
"password"
);
When I mount with the username and password:
When I mount with username and password as undefined it works in the terminal but not in service.