Dec 23 2021 04:16 AM
Hi folks,
I am using the current psexec.exe on my Windows Server 2022 to run Powershell in system context.
Then I mount a drive like this:
net use X: \\192.168.2.2\X /USER:user password /GLOBAL
The mapping works fine and the share is accessable from user context. But removing the mapping with net use is not possible anymore:
net use X: /delete
I will receive the following error message:
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
To remove I have to call the Powershell function:
Remove-SmbGlobalMapping X: \\192.168.2.2\X
It seems that there is lack of functionality of net use?
Dec 27 2021 11:41 AM
Dec 29 2021 12:36 AM
Yes, the delete was execute in the same context.
The need is forced by the /GLOBAL parameter, since only the system context is allowed to map a drive to all users. Of course, a group policy would be a solution but differs a little bit to my boundary conditions:
A service running in the system context sould map the drive for all users and also should delete the mapping after a well defined amount of time / operations.
Dec 29 2021 04:37 AM
Dec 29 2021 05:45 AM
Dec 29 2021 06:40 AM
SolutionDec 29 2021 08:23 AM
Dec 29 2021 08:27 AM
Jan 04 2024 09:47 AM
Hi!
Does the "/GLOBAL" switch map the drive to the users in the local Administrators group or also to other local users? This is regarding the statement "... since only the system context is allowed to map a drive to all users.".
rgds Christian
Dec 29 2021 06:40 AM
Solution