Sign in with
Sign up | Sign in
Your question

Startup Scripts

Last response: in Windows 2000/NT
Share
Anonymous
August 15, 2005 8:20:35 PM

Archived from groups: microsoft.public.win2000.group_policy,microsoft.public.windows.group_policy (More info?)

I'm trying to run this BAT script:

if not exist c:\access03\msaccess.exe \\server\share\office2003\maintwiz.exe
/c \\server\share\office2003\addaccess.cmw /qb-

via a computer startup script. So, cmd.exe doesn't accept UNC paths. How
can I get this script to run, if UNC paths are invalid, but the computer
hasn't gotten drive mappings yet?

Need to do it under the Computer startup script before the user logs on
because users don't have admin rights.

How can I make this run?

Thanks,

Ken

More about : startup scripts

Anonymous
August 15, 2005 9:33:35 PM

Archived from groups: microsoft.public.win2000.group_policy,microsoft.public.windows.group_policy (More info?)

Ken B wrote:
> I'm trying to run this BAT script:
> if not exist c:\access03\msaccess.exe
> \\server\share\office2003\maintwiz.exe /c
> \\server\share\office2003\addaccess.cmw /qb-
> via a computer startup script. So, cmd.exe doesn't accept UNC paths.

Actually, it accepts them just fine. Your problem is that the script runs
under the local machine account, which is unknown to the network, so access
to network resources is denied.

The workaround for this is to create an Active Directory user account for
your scripts. Then, at the top of your script, add something along the
lines of:

net use \\server\share scriptuserpassword /user:scriptuser

The price of this is having to include the password for the account in clear
text, in your scripts. It would be a good idea to restrict this account as
much as possible -- it only needs access to the one share you want to use
for this purpose.


--
Chris Priede (priede@panix.com)
Anonymous
August 16, 2005 12:33:07 PM

Archived from groups: microsoft.public.win2000.group_policy,microsoft.public.windows.group_policy (More info?)

Hi Chris-

Thanks for getting back to me. I'm experiencing 2 issues...1 is that I
tried running the script before modification (on my own by double clicking),
and it told me UNC paths were not supported.
'\\tr.LOCAL\SysVol\trc.LOCAL\Policies\{9B863144-1228-4710-8C99-5A3FDC655BF1}\Machine\Scripts\Startup'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

C:\WINNT>if not exist c:\access03\msaccess.exe
\\server\share\office2003\maintwiz.exe /c
\\server\share\office2003\addaccess.cmw /qb-

C:\WINNT>pause
Press any key to continue . . .

If I go with your suggestion of inserting net use, where should I place the
net use, password and /user:scriptuser in relation to the rest of the
command I want to run? It should go:
net use \\server\share\office2003\maintwiz.exe /c
\\server\share\office2003\addaccess.cmw /qb- password /user:scriptuser ?

The other issue is that on the share \\server\share, "Everyone" has Full
Control. I went into the Security tab of the Office2003 folder, clicked
Advanced and looked at the effective permissions for a user's computer, and
it came back with everything checked... so it should allow the computer in
there, no?

TIA

Ken

"Chris Priede" <priede@panix.com> wrote in message
news:o vt3qDeoFHA.2472@TK2MSFTNGP15.phx.gbl...
> Ken B wrote:
>> I'm trying to run this BAT script:
>> if not exist c:\access03\msaccess.exe
>> \\server\share\office2003\maintwiz.exe /c
>> \\server\share\office2003\addaccess.cmw /qb-
>> via a computer startup script. So, cmd.exe doesn't accept UNC paths.
>
> Actually, it accepts them just fine. Your problem is that the script runs
> under the local machine account, which is unknown to the network, so
> access to network resources is denied.
>
> The workaround for this is to create an Active Directory user account for
> your scripts. Then, at the top of your script, add something along the
> lines of:
>
> net use \\server\share scriptuserpassword /user:scriptuser
>
> The price of this is having to include the password for the account in
> clear text, in your scripts. It would be a good idea to restrict this
> account as much as possible -- it only needs access to the one share you
> want to use for this purpose.
>
>
> --
> Chris Priede (priede@panix.com)
>
Related resources
Anonymous
August 16, 2005 3:52:49 PM

Archived from groups: microsoft.public.win2000.group_policy,microsoft.public.windows.group_policy (More info?)

Hi,

Ken B wrote:
> I tried running the script before modification (on my own by double
> clicking), and it told me UNC paths were not supported.

To clarify: UNC paths are not supported for the current directory, but are
supported for most other uses.

If you want to use a UNC network path as the current directory in a script,
use pushd and popd. pushd used with a UNC path temporarily maps the
referenced share to a drive letter and changes to that drive/path.

The use of UNC paths is fine in the command line proposed in your first
post.

> If I go with your suggestion of inserting net use, where should I
> place the net use, password and /user:scriptuser in relation to the
> rest of the command I want to run?

It would be a script of at least two lines, not a single command -- the
first line would be "net use", the second line can be exactly as you had
proposed it in your first post. Don't forget to change "scriptuser" to the
logon name of the account you are going to use.

If you are doing this with a program that must be run from current directory
(or doesn't take UNC paths for filename arguments), then the whole script
could look like this:

if not exist c:\access03\msaccess.exe (
net use \\server\share scriptuserpassword /user:scriptuser
pushd \\server\share\office2003
maintwiz.exe /c addaccess.cmw /qb-
popd
)

It cold be made more complicated, with more error checking, but you see the
idea.

--
Chris Priede (priede@panix.com)
Anonymous
August 16, 2005 6:34:52 PM

Archived from groups: microsoft.public.win2000.group_policy,microsoft.public.windows.group_policy (More info?)

Aha! I mis-interpreted what it was telling me... I thought it wouldn't
accept the UNC path as part of the command I wanted to pass. I'll try
pressing forward using the UNC paths, maybe some quotes might do the trick?

Thanks again,

Ken

"Chris Priede" <priede@panix.com> wrote in message
news:o 6CT7pnoFHA.468@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> Ken B wrote:
>> I tried running the script before modification (on my own by double
>> clicking), and it told me UNC paths were not supported.
>
> To clarify: UNC paths are not supported for the current directory, but
> are supported for most other uses.
>
> If you want to use a UNC network path as the current directory in a
> script, use pushd and popd. pushd used with a UNC path temporarily maps
> the referenced share to a drive letter and changes to that drive/path.
>
> The use of UNC paths is fine in the command line proposed in your first
> post.
>
>> If I go with your suggestion of inserting net use, where should I
>> place the net use, password and /user:scriptuser in relation to the
>> rest of the command I want to run?
>
> It would be a script of at least two lines, not a single command -- the
> first line would be "net use", the second line can be exactly as you had
> proposed it in your first post. Don't forget to change "scriptuser" to
> the logon name of the account you are going to use.
>
> If you are doing this with a program that must be run from current
> directory (or doesn't take UNC paths for filename arguments), then the
> whole script could look like this:
>
> if not exist c:\access03\msaccess.exe (
> net use \\server\share scriptuserpassword /user:scriptuser
> pushd \\server\share\office2003
> maintwiz.exe /c addaccess.cmw /qb-
> popd
> )
>
> It cold be made more complicated, with more error checking, but you see
> the idea.
>
> --
> Chris Priede (priede@panix.com)
>
!