Forum Discussion
ondeso666
Dec 23, 2021Copper Contributor
net use in system context and global SMB mount option cannot be removed
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 /GL...
- Dec 29, 2021C:\WINDOWS\system32>net use x: \\localhost\admin$ /global
The command completed successfully.
C:\WINDOWS\system32>net use x: /global /delete
x: was deleted successfully.
That does work?
ondeso666
Dec 29, 2021Copper Contributor
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.
Christian_Eriksson
Jan 04, 2024Copper Contributor
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