Script Syntax

P

Paul Banco

All,

I am trying to map a particular drive through a login script. I am use this
syntax if "%username%"= = "xuser" net use \\server\share

For some reason I can not get this to work. Does anyone know the correct
syntax or have a place on the web that has some samples?

Thanks
Paul
 
D

Dean Wells [MVP]

Your syntax appears mostly accurate though you included a space between
the "==" function and neglected to specify a drive letter, either of
which may be the cause of your problem -

if "%username%"== "xuser" net use F: \\server\share

HTH

Dean
 
P

Paul Banco

Dean,

I tried both of these scripts below and they did not work. She can manually
map to the drive. Does it matter that she is not mapping to the share level
but one deep.

if "%username%"== "Jlundgren" net use N: \\ob12\finance$\scanning
if %username% == Jlundgren net use N: \\ob12\finance$\scanning
Dean Wells said:
Your syntax appears mostly accurate though you included a space between
the "==" function and neglected to specify a drive letter, either of
which may be the cause of your problem -

if "%username%"== "xuser" net use F: \\server\share

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Paul Banco said:
All,

I am trying to map a particular drive through a login script. I am use this
syntax if "%username%"= = "xuser" net use \\server\share

For some reason I can not get this to work. Does anyone know the correct
syntax or have a place on the web that has some samples?

Thanks
Paul
 
D

Dean Wells [MVP]

That depends on the client type ... what OS is the script executing on?

In addition, have you determined if the case of your string comparison
is the cause. Try this as well -

if /i "%username%"== "xuser" net use F: \\server\share

If this continues to fail, redirect stderr to a file by appending -

2>error.log

.... to the end of the net use command.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Paul Banco said:
Dean,

I tried both of these scripts below and they did not work. She can manually
map to the drive. Does it matter that she is not mapping to the share level
but one deep.

if "%username%"== "Jlundgren" net use N: \\ob12\finance$\scanning
if %username% == Jlundgren net use N: \\ob12\finance$\scanning
Dean Wells said:
Your syntax appears mostly accurate though you included a space between
the "==" function and neglected to specify a drive letter, either of
which may be the cause of your problem -

if "%username%"== "xuser" net use F: \\server\share

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Paul Banco said:
All,

I am trying to map a particular drive through a login script. I am
use
this
syntax if "%username%"= = "xuser" net use \\server\share

For some reason I can not get this to work. Does anyone know the correct
syntax or have a place on the web that has some samples?

Thanks
Paul
 
P

Paul Banco

Dean,

That worked. What exactly does the if /i do? Also I posted a LPT problem
under Paul Banco. I know you are busy but if you can take a look at that as
well it would be greatly appreciated.

Thanks for all your help
Paul
Dean Wells said:
That depends on the client type ... what OS is the script executing on?

In addition, have you determined if the case of your string comparison
is the cause. Try this as well -

if /i "%username%"== "xuser" net use F: \\server\share

If this continues to fail, redirect stderr to a file by appending -

2>error.log

... to the end of the net use command.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


Paul Banco said:
Dean,

I tried both of these scripts below and they did not work. She can manually
map to the drive. Does it matter that she is not mapping to the share level
but one deep.

if "%username%"== "Jlundgren" net use N: \\ob12\finance$\scanning
if %username% == Jlundgren net use N: \\ob12\finance$\scanning
Dean Wells said:
Your syntax appears mostly accurate though you included a space between
the "==" function and neglected to specify a drive letter, either of
which may be the cause of your problem -

if "%username%"== "xuser" net use F: \\server\share

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


All,

I am trying to map a particular drive through a login script. I am use
this
syntax if "%username%"= = "xuser" net use \\server\share

For some reason I can not get this to work. Does anyone know the
correct
syntax or have a place on the web that has some samples?

Thanks
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top