Discussion:
SUBST command
(too old to reply)
Synapse Syndrome
2008-08-03 04:59:43 UTC
Permalink
Can the SUBST command be used on a startup script, or only a logon script?

ie. Can these mappings be used remotely on the server, when no user has
logged in?

ss.
Pegasus (MVP)
2008-08-03 06:05:19 UTC
Permalink
Post by Synapse Syndrome
Can the SUBST command be used on a startup script, or only a logon script?
ie. Can these mappings be used remotely on the server, when no user has
logged in?
ss.
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
Synapse Syndrome
2008-08-03 06:37:19 UTC
Permalink
Post by Pegasus (MVP)
Post by Synapse Syndrome
Can the SUBST command be used on a startup script, or only a logon script?
ie. Can these mappings be used remotely on the server, when no user has
logged in?
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.

I cannot check myself at the moment, because I am in the middle of a major
reconfiguration, and I was just thinking about possibilities of how I can
sort this out.

I am using a NAS-like appliance (Drobo), that seems to only be able to show
all the contained disks as a very large striped partition. I was hoping
that making virtual drives would make it easier to sort the types of data in
the array.

ss.
Synapse Syndrome
2008-08-03 07:19:20 UTC
Permalink
Post by Synapse Syndrome
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?

ss.
Pegasus (MVP)
2008-08-03 07:54:37 UTC
Permalink
Post by Synapse Syndrome
Post by Synapse Syndrome
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?
ss.
It depends on what you want the script to do.
Synapse Syndrome
2008-08-03 22:11:57 UTC
Permalink
Post by Pegasus (MVP)
Post by Synapse Syndrome
Post by Synapse Syndrome
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?
It depends on what you want the script to do.
I want it to make virtual drives for two user groups using the SUBST
command.

ss.
Pegasus (MVP)
2008-08-03 22:20:26 UTC
Permalink
Post by Synapse Syndrome
Post by Pegasus (MVP)
Post by Synapse Syndrome
Post by Synapse Syndrome
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?
It depends on what you want the script to do.
I want it to make virtual drives for two user groups using the SUBST
command.
ss.
You need to place the subst.exe or net.exe commands into the
individual user's logon script.
Bruce Sanderson
2008-08-04 19:21:44 UTC
Permalink
To elaborate on what Pegasus said, like Mapped Network Drives, the mappings
created by the subst command are artifacts of the user's Windows Session,
not the OS environment. When a user logs on, their Windows Session is
created. If there are "persistent" Mapped Network Drives" in the user's
profile, they will be recreated automatically. The mapping made by subst
are not persistent so will not be recreated automatically.

Since the mappings are an artifact of the user's Windows Session there is no
way to make them apply to anyone that logs on, without arranging for the
subst command to be re-issued as part of the logon process - e.g. in a logon
script.

If you want the subst mapping to apply to anyone that logs on to a
particular computer, you can put the subst command in a .cmd file in the All
Users, Start Menu, Programs, Startup since anything there will be executed
as part of the logon process for any user that logs on to that computer.
--
Bruce Sanderson
http://members.shaw.ca/bsanders

It is perfectly useless to know the right answer to the wrong question.
Post by Pegasus (MVP)
Post by Synapse Syndrome
Post by Pegasus (MVP)
Post by Synapse Syndrome
Post by Synapse Syndrome
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?
It depends on what you want the script to do.
I want it to make virtual drives for two user groups using the SUBST
command.
ss.
You need to place the subst.exe or net.exe commands into the
individual user's logon script.
TwoHawks D
2011-01-21 00:24:43 UTC
Permalink
I stumbled upon this post while researching a related need, and I think it is possible to assign the Subst in a Global User (System / NT Authority) context, but not directly.

Following from this: http://msdn.microsoft.com/en-us/library/aa363908%28v=VS.85%29.aspx
...it seems you can instantiate a subst globally via either the api or possibly directly in the registry using the DefineDosDevice function or method. Sorry, I do not know how this may or may not apply to Win Servers, however...

My problem was attempting to use subst for a folder for apache, which needs to see the mount as system user, or globally (so subst doesn't work). Any way you try to do a subst, even using something such as RunAsSystem, will fail to produce a viable result.

However, I found that by creating the DosDevice in the registry I have a viable 'subst' mount that apache/mysql/php-win can use.

Example: subst S: C:\PortableUSB

asA.reg file...
[code]
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"S:"="\\??\\C:\\PortableUSB"
[/code]

Or, in the registry it will look like this (so you can manually add it this way)...
A String Name of "S:" (without the quotes. Use your preferred DriveLetter, of course)
This String's Value is "\??\C:\PortableUSB" (without the quotes. Use your own path, of course)

Requires a restart. The subst is persistent and available globally. I do not yet know how reliable it is, but I am using it with success so far.
-----------
I hope this is not inappropriately posted, seeing as how this is a server newsgroup and I am doing this in XP, but info on this is scant to find, and this is one of the few hits discussing this issue - I feel it may be helpful to others investigating this sort of thing.
cheers, twohawks
Post by Synapse Syndrome
Can the SUBST command be used on a startup script, or only a logon script?
ie. Can these mappings be used remotely on the server, when no user has
logged in?
ss.
Post by Pegasus (MVP)
If subst.exe gave you a globally accessible drive then this would
consistitute a big security breach - but why don't you give it a try
yourself? You can use runas.exe to test the visibility of the substituted
drive.
Post by Synapse Syndrome
I was just hoping that somebody would know for sure, but it does seem
unlikely now, with the implication you just raised.
I cannot check myself at the moment, because I am in the middle of a major
reconfiguration, and I was just thinking about possibilities of how I can
sort this out.
I am using a NAS-like appliance (Drobo), that seems to only be able to show
all the contained disks as a very large striped partition. I was hoping
that making virtual drives would make it easier to sort the types of data in
the array.
ss.
Post by Synapse Syndrome
Is there any way a service can be used to run a script for certain user
accounts without having to log in with those accounts?
ss.
Post by Pegasus (MVP)
It depends on what you want the script to do.
Post by Synapse Syndrome
I want it to make virtual drives for two user groups using the SUBST
command.
ss.
Post by Pegasus (MVP)
You need to place the subst.exe or net.exe commands into the
individual user's logon script.
Post by Bruce Sanderson
To elaborate on what Pegasus said, like Mapped Network Drives, the mappings
created by the subst command are artifacts of the user's Windows Session,
not the OS environment. When a user logs on, their Windows Session is
created. If there are "persistent" Mapped Network Drives" in the user's
profile, they will be recreated automatically. The mapping made by subst
are not persistent so will not be recreated automatically.
Since the mappings are an artifact of the user's Windows Session there is no
way to make them apply to anyone that logs on, without arranging for the
subst command to be re-issued as part of the logon process - e.g. in a logon
script.
If you want the subst mapping to apply to anyone that logs on to a
particular computer, you can put the subst command in a .cmd file in the All
Users, Start Menu, Programs, Startup since anything there will be executed
as part of the logon process for any user that logs on to that computer.
--
Bruce Sanderson
http://members.shaw.ca/bsanders
It is perfectly useless to know the right answer to the wrong question.
Submitted via EggHeadCafe
Excel Generate High Quality RoadMaps
http://www.eggheadcafe.com/tutorials/aspnet/3310004f-e1ae-45a7-9bea-7b2b970d1230/excel-generate-high-quality-roadmaps.aspx
TwoHawks D
2011-01-21 00:44:34 UTC
Permalink
The post dropped the asA.reg file and added weird formatting I cannot control at the hosting site for this post, so if you do not know the proper syntax you can create one manually in the registry and then export it for observation.

Submitted via EggHeadCafe
ASP.NET Base64 Image Encoding via the Data: protocol
http://www.eggheadcafe.com/tutorials/aspnet/70f76817-e6d2-415d-8849-849d8c6c5385/aspnet-base64-image-encoding-via-the-data-protocol.aspx
Loading...