Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - csccmd not running in script

Reply
 
Old 12-17-2008   #1 (permalink)
wcmulligan


 
 

csccmd not running in script

Hello,

I am editing a script to move users to a new file share. The changes to the
new server work fine, but the last part of the script to change the offline
files server never seems to run.

WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
\\DFS\user\shares\%username%"

Never seems to run. Is there something wrong with this line or is their
something I am missing.

I'm on a deadline any help is appreciated.

My System SpecsSystem Spec
Old 12-17-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: csccmd not running in script


"wcmulligan" <wcmulligan@xxxxxx> wrote in message
news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
Quote:

> Hello,
>
> I am editing a script to move users to a new file share. The changes to
> the
> new server work fine, but the last part of the script to change the
> offline
> files server never seems to run.
>
> WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
> \\DFS\user\shares\%username%"
>
> Never seems to run. Is there something wrong with this line or is their
> something I am missing.
>
> I'm on a deadline any help is appreciated.
I always prefix commands with "%comspec% /c" when I use the Run method of
the wshShell object.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 12-18-2008   #3 (permalink)
wcmulligan


 
 

Re: csccmd not running in script

Thank you Richard, but this didn't do the trick either.

I can run csccmd /moveshare:\\OldShare\%sername%$
\\DFS\user\shares\%username% from the command line or a batch file, but I
can't get it to run in a script.

I've checked and it runs up to the point of the command and then stops.

Anyone have any ideas that might help?

"Richard Mueller [MVP]" wrote:
Quote:

>
> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
> news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
Quote:

> > Hello,
> >
> > I am editing a script to move users to a new file share. The changes to
> > the
> > new server work fine, but the last part of the script to change the
> > offline
> > files server never seems to run.
> >
> > WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
> > \\DFS\user\shares\%username%"
> >
> > Never seems to run. Is there something wrong with this line or is their
> > something I am missing.
> >
> > I'm on a deadline any help is appreciated.
>
> I always prefix commands with "%comspec% /c" when I use the Run method of
> the wshShell object.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Old 12-18-2008   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: csccmd not running in script

I'm not familiar with the csccmd utility, but the %username% environment
variable resolves correctly when I run commands with the Run method. I would
use:

strCmd = "%comspec% /c csccmd /moveshare:\\OldShare\%username%$
\\DFS\user\shares\%username%"
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Run(strCmd, 2, True)
Wscript.Echo "Return code: " & CStr(intReturn)

The parameter "2" means to run minimized. The "True" means to wait for the
command to complete so we can retrieve the return code. This way we can echo
the return code. If it is non-zero, the csccmd returned an error code that
may help troubleshoot.

One possibility is that there is a permission issue. If the OS is Vista, for
example, you may need to use "Run as Administrator" when you run the script.
Being logged in as Administrator means nothing in Vista. Also, is csccmd on
the path? If not, you should include the path in the command.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"wcmulligan" <wcmulligan@xxxxxx> wrote in message
news:244C53E3-8A62-420B-9405-02E407BA57B0@xxxxxx
Quote:

> Thank you Richard, but this didn't do the trick either.
>
> I can run csccmd /moveshare:\\OldShare\%sername%$
> \\DFS\user\shares\%username% from the command line or a batch file, but I
> can't get it to run in a script.
>
> I've checked and it runs up to the point of the command and then stops.
>
> Anyone have any ideas that might help?
>
> "Richard Mueller [MVP]" wrote:
>
Quote:

>>
>> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
>> news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
Quote:

>> > Hello,
>> >
>> > I am editing a script to move users to a new file share. The changes
>> > to
>> > the
>> > new server work fine, but the last part of the script to change the
>> > offline
>> > files server never seems to run.
>> >
>> > WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
>> > \\DFS\user\shares\%username%"
>> >
>> > Never seems to run. Is there something wrong with this line or is
>> > their
>> > something I am missing.
>> >
>> > I'm on a deadline any help is appreciated.
>>
>> I always prefix commands with "%comspec% /c" when I use the Run method of
>> the wshShell object.
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>>

My System SpecsSystem Spec
Old 12-18-2008   #5 (permalink)
wcmulligan


 
 

Re: csccmd not running in script

Thanks again Richard, but I don't get a return value.

I moved the code around a little so that csccmd runs before anything else
and I get no echo. I do get an echo in other parts of the script, so I don't
know why it is not working.

I am running the command with full admin priveledges on an xp box for
testing. this util won't work with Vista.

FYI here is a link to Microsoft's csccmd.exe syntax
http://support.microsoft.com/default.aspx/kb/884739

"Richard Mueller [MVP]" wrote:
Quote:

> I'm not familiar with the csccmd utility, but the %username% environment
> variable resolves correctly when I run commands with the Run method. I would
> use:
>
> strCmd = "%comspec% /c csccmd /moveshare:\\OldShare\%username%$
> \\DFS\user\shares\%username%"
> Set objShell = CreateObject("Wscript.Shell")
> intReturn = objShell.Run(strCmd, 2, True)
> Wscript.Echo "Return code: " & CStr(intReturn)
>
> The parameter "2" means to run minimized. The "True" means to wait for the
> command to complete so we can retrieve the return code. This way we can echo
> the return code. If it is non-zero, the csccmd returned an error code that
> may help troubleshoot.
>
> One possibility is that there is a permission issue. If the OS is Vista, for
> example, you may need to use "Run as Administrator" when you run the script.
> Being logged in as Administrator means nothing in Vista. Also, is csccmd on
> the path? If not, you should include the path in the command.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
> news:244C53E3-8A62-420B-9405-02E407BA57B0@xxxxxx
Quote:

> > Thank you Richard, but this didn't do the trick either.
> >
> > I can run csccmd /moveshare:\\OldShare\%sername%$
> > \\DFS\user\shares\%username% from the command line or a batch file, but I
> > can't get it to run in a script.
> >
> > I've checked and it runs up to the point of the command and then stops.
> >
> > Anyone have any ideas that might help?
> >
> > "Richard Mueller [MVP]" wrote:
> >
Quote:

> >>
> >> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
> >> news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
> >> > Hello,
> >> >
> >> > I am editing a script to move users to a new file share. The changes
> >> > to
> >> > the
> >> > new server work fine, but the last part of the script to change the
> >> > offline
> >> > files server never seems to run.
> >> >
> >> > WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
> >> > \\DFS\user\shares\%username%"
> >> >
> >> > Never seems to run. Is there something wrong with this line or is
> >> > their
> >> > something I am missing.
> >> >
> >> > I'm on a deadline any help is appreciated.
> >>
> >> I always prefix commands with "%comspec% /c" when I use the Run method of
> >> the wshShell object.
> >>
> >> --
> >> Richard Mueller
> >> MVP Directory Services
> >> Hilltop Lab - http://www.rlmueller.net
> >> --
> >>
> >>
> >>
>
>
>
My System SpecsSystem Spec
Old 12-18-2008   #6 (permalink)
Tom Lavedas


 
 

Re: csccmd not running in script

On Dec 18, 1:33*pm, wcmulligan <wcmulli...@xxxxxx>
wrote:
Quote:

> Thanks again Richard, but I don't get a return value.
>
> I moved the code around a little so that csccmd runs before anything else
> and I get no echo. *I do get an echo in other parts of the script, so Idon't
> know why it is not working.
>
> I am running the command with full admin priveledges on an xp box for
> testing. this util won't work with Vista.
>
> FYI here is a link to Microsoft's csccmd.exe syntaxhttp://support.microsoft.com/default.aspx/kb/884739
>
> "Richard Mueller [MVP]" wrote:
Quote:

> > I'm not familiar with the csccmd utility, but the %username% environment
> > variable resolves correctly when I run commands with the Run method. I would
> > use:
>
Quote:

> > strCmd = "%comspec% /c csccmd /moveshare:\\OldShare\%username%$
> > \\DFS\user\shares\%username%"
> > Set objShell = CreateObject("Wscript.Shell")
> > intReturn = objShell.Run(strCmd, 2, True)
> > Wscript.Echo "Return code: " & CStr(intReturn)
>
Quote:

> > The parameter "2" means to run minimized. The "True" means to wait for the
> > command to complete so we can retrieve the return code. This way we canecho
> > the return code. If it is non-zero, the csccmd returned an error code that
> > may help troubleshoot.
>
Quote:

> > One possibility is that there is a permission issue. If the OS is Vista, for
> > example, you may need to use "Run as Administrator" when you run the script.
> > Being logged in as Administrator means nothing in Vista. Also, is csccmd on
> > the path? If not, you should include the path in the command.
>
Quote:

> > --
> > Richard Mueller
> > MVP Directory Services
> > Hilltop Lab -http://www.rlmueller.net
> > --
>
Quote:

> > "wcmulligan" <wcmulli...@xxxxxx> wrote in message
> >news:244C53E3-8A62-420B-9405-02E407BA57B0@xxxxxx
Quote:

> > > Thank you Richard, but this didn't do the trick either.
>
Quote:
Quote:

> > > I can run csccmd /moveshare:\\OldShare\%sername%$
> > > \\DFS\user\shares\%username% *from the command line or a batch file, but I
> > > can't get it to run in a script.
>
Quote:
Quote:

> > > I've checked and it runs up to the point of the command and then stops.
>
Quote:
Quote:

> > > Anyone have any ideas that might help?
>
Quote:
Quote:

> > > "Richard Mueller [MVP]" wrote:
>
Quote:
Quote:

> > >> "wcmulligan" <wcmulli...@xxxxxx> wrote in message
> > >>news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
> > >> > Hello,
>
Quote:
Quote:

> > >> > I am editing a script to move users to a new file share. *The changes
> > >> > to
> > >> > the
> > >> > new server work fine, but the last part of the script to change the
> > >> > offline
> > >> > files server never seems to run.
>
Quote:
Quote:

> > >> > WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
> > >> > \\DFS\user\shares\%username%"
>
Quote:
Quote:

> > >> > Never seems to run. *Is there something wrong with this line or is
> > >> > their
> > >> > something I am missing.
>
Quote:
Quote:

> > >> > I'm on a deadline any help is appreciated.
>
Quote:
Quote:

> > >> I always prefix commands with "%comspec% /c" when I use the Run method of
> > >> the wshShell object.
>
Quote:
Quote:

> > >> --
> > >> Richard Mueller
> > >> MVP Directory Services
> > >> Hilltop Lab -http://www.rlmueller.net
> > >> --
Does the username have a space in it? Are you running this as a
logged in user? Is the error trapping disabled in the script
disabled? If so, re-enable it (remove ON ERROR RESUME NEXT line) and
report what the real error is. I say that because you say you get no
output, when you really should.

Finally, can you show us the EXACT (cut and paste) code for the
objShell.Run line (with Richard's proposed fix - which is correct)?
Someone might see something you've missed.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Old 12-18-2008   #7 (permalink)
Pegasus \(MVP\)


 
 

Re: csccmd not running in script


"wcmulligan" <wcmulligan@xxxxxx> wrote in message
news:3C72CBCD-3778-4258-8F18-4CBED452F04C@xxxxxx
Quote:

> Thanks again Richard, but I don't get a return value.
>
> I moved the code around a little so that csccmd runs before anything else
> and I get no echo. I do get an echo in other parts of the script, so I
> don't
> know why it is not working.
>
> I am running the command with full admin priveledges on an xp box for
> testing. this util won't work with Vista.
>
> FYI here is a link to Microsoft's csccmd.exe syntax
> http://support.microsoft.com/default.aspx/kb/884739
>
> "Richard Mueller [MVP]" wrote:
>
Quote:

>> I'm not familiar with the csccmd utility, but the %username% environment
>> variable resolves correctly when I run commands with the Run method. I
>> would
>> use:
>>
>> strCmd = "%comspec% /c csccmd /moveshare:\\OldShare\%username%$
>> \\DFS\user\shares\%username%"
>> Set objShell = CreateObject("Wscript.Shell")
>> intReturn = objShell.Run(strCmd, 2, True)
>> Wscript.Echo "Return code: " & CStr(intReturn)
>>
>> The parameter "2" means to run minimized. The "True" means to wait for
>> the
>> command to complete so we can retrieve the return code. This way we can
>> echo
>> the return code. If it is non-zero, the csccmd returned an error code
>> that
>> may help troubleshoot.
>>
>> One possibility is that there is a permission issue. If the OS is Vista,
>> for
>> example, you may need to use "Run as Administrator" when you run the
>> script.
>> Being logged in as Administrator means nothing in Vista. Also, is csccmd
>> on
>> the path? If not, you should include the path in the command.
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
>> news:244C53E3-8A62-420B-9405-02E407BA57B0@xxxxxx
Quote:

>> > Thank you Richard, but this didn't do the trick either.
>> >
>> > I can run csccmd /moveshare:\\OldShare\%sername%$
>> > \\DFS\user\shares\%username% from the command line or a batch file,
>> > but I
>> > can't get it to run in a script.
>> >
>> > I've checked and it runs up to the point of the command and then stops.
>> >
>> > Anyone have any ideas that might help?
>> >
>> > "Richard Mueller [MVP]" wrote:
>> >
>> >>
>> >> "wcmulligan" <wcmulligan@xxxxxx> wrote in message
>> >> news:CEDB4345-D420-4F3D-BDD5-64716B7C5651@xxxxxx
>> >> > Hello,
>> >> >
>> >> > I am editing a script to move users to a new file share. The
>> >> > changes
>> >> > to
>> >> > the
>> >> > new server work fine, but the last part of the script to change the
>> >> > offline
>> >> > files server never seems to run.
>> >> >
>> >> > WshShell.Run "c:\csccmd.exe /moveshare:\\OldShare\%username%$
>> >> > \\DFS\user\shares\%username%"
>> >> >
>> >> > Never seems to run. Is there something wrong with this line or is
>> >> > their
>> >> > something I am missing.
>> >> >
>> >> > I'm on a deadline any help is appreciated.
>> >>
>> >> I always prefix commands with "%comspec% /c" when I use the Run method
>> >> of
>> >> the wshShell object.
>> >>
>> >> --
>> >> Richard Mueller
>> >> MVP Directory Services
>> >> Hilltop Lab - http://www.rlmueller.net
>> >> --
>> >>
>> >>
>> >>
>>
I note an essential difference between the command you ran manually and the
command you scripted:
c:\csccmd.exe /moveshare:\\OldShare\%username%$
\\DFS\user\shares\%username%"
csccmd /moveshare:\\OldShare\%sername%$ \\DFS\user\shares\%username%

The scripted command states explicitly the location of csccmd.exe.
The manual command relies on the %path%. It gives no file extension. It also
refers to %sername% instead of %username%, which is probably a typo.

Questions:
- Where does csccmd reside?
- Is it an .exe file or is it something else?

Lastly: If the command runs while embedded in a batch file then you could
take a pragmatic view and invoke that batch file from your script. To avoid
having to maintain two files, you could generate the batch file from within
your script with a single writeline statement.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
error running script PowerShell
Running PowerShell script from within an MSI? PowerShell
Logon script not running? Vista General
trouble running a script PowerShell
Help on running a a script PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46