Re: VBS login script not processing .CMD file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The error message seems to indicate that snetcfg.exe was not found, so the
current directory when the cmd runs is not what you expect. I would try (for
example):

%0\..\snetcfg.exe -v -u MS_Server

Note that the same syntax was used to run osver and that seemed to work.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--

"Blenvid" <Blenvid@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DE35C729-B086-495D-A48D-96DC1C81F7CE@xxxxxxxxxxxxxxxx
Hello, and thanks for reading my post.

I work on a Server 2003 Active Directory Integrated domain. Most of the
clients are Windows XP clients, but there are a couple 2000 Pro. clients
as
well as a couple 2000 Servers and NT servers. This is a rather complex
issue
so I'll try and make it as brief as possible.

Network Security policy dictates that we have to run a certain product
which
fixes most out of the box vulnerabilities on Windows systems, including
File
and Print Sharing. Unfortunately, we have a product, which is required,
which
needs File and Print Sharing so without the manpower to go to over 800
systems, I'm looking for an automated way to get it done.

I've found through numerous discussions online that there is no easy way
to
enable or disable it via GPO, the only way which seems to work for people
is
with the use of a ?snetcfg.exe? or ?snetcfg_xp.exe? file which was written
by
a semi-famous programmer, Bill Steward, to drop down to the programming of
the NIC adaptor and change it. Here?s some of the links that are just a
couple of the ones I found mentioning the ?snetcfg.exe? as the solution,
the
only solution which works. Microsoft articles relating to this are talking
about the ?File and Print Sharing? option which is a part of the Windows
Firewall. We have the Windows Firewall disabled so these don?t apply. Here
?s
some links:


http://help.lockergnome.com/windows2/File-printer-sharing-group-policy-ftopict183458.html

http://www.experts-exchange.com/Networking/Windows_Networking/Q_20820999.html?qid=20820999
http://internet.cybermesa.com/~bstewart/wast.html
http://www.tek-tips.com/viewthread.cfm?qid=929271&page=7

I downloaded the files ?snetcfg.exe?, ?snetcfg_xp.exe? and ?osver.exe. I
dropped them in the netlogon folder of our DC and edited the test.vbs
script
to include the ?FP_set.cmd? file I created with the instructions on one of
the websites. Here's the VBS code which is to run the CMD file:

--------------------start code example----------------------------------

' ******* Enable File and Print Sharing***************
WshShell.Run ("%LOGONSERVER%\netlogon\FP_set.cmd")

----------------------end code
example-------------------------------------

The code seems to run at first in the CMD file, because it returns the
correct OS in the beginning. However, I later see numerous "snetcfg.exe is
not recognized as an internal or external command, operable program, or
batch
file." Here is the code of the command file:

----------------------start code example---------------------------------

@ECHO OFF

REM Determine which version of OS is running.
%0\..\OSVER /QUIET /TERMINALS
SET OSVER=%ERRORLEVEL%
IF %OSVER%==6 GOTO :W2K
IF %OSVER%==7 GOTO :XP


:w2K

snetcfg.exe -v -u MS_Server
snetcfg.exe -v -l %system%\inf \netserv.inf -c S -i ms_server
NET STOP BROWSER
NET STOP SERVER
NET START BROWSER
NET START SERVER
goto EOF

:XP

snetcfg_wxp.exe -v -u MS_Server
snetcfg_wxp.exe -v -l %system%\inf \netserv.inf -c S -i MS_Server
NET STOP BROWSER
NET STOP SERVER
NET START BROWSER
NET START SERVER
goto EOF

:EOF

---------------------end code example-----------------------

I have a feeling I've referenced the CMD in the VBscript in an improper
format. But I can't be sure. Any suggestions or corrections of code would
be
greatly appreciated.


.



Relevant Pages

  • Help with IPFW + NATD + Passive FTP
    ... passive FTP connections through IPFW with NATD enabled. ... $cmd 005 allow all from any to any via dc0 ... # Interface facing Public internet ... # Allow out access to my ISP's Domain name server. ...
    (freebsd-questions)
  • ICMP redirect
    ... $cmd 005 allow all from any to any via rl1 ... $cmd 014 divert natd ip from any to any in via $pif ... # Allow out access to my ISP's Domain name server. ... # Deny all inbound traffic from non-routable reserved address spaces ...
    (freebsd-questions)
  • ipfw + natd + stateful rules. For the archives
    ... $cmd 100 divert natd ip from any to any in via $pif ... $cmd 450 deny log ip from any to any ... # Interface facing Public internet ... # Allow out access to my ISP's Domain name server. ...
    (freebsd-questions)
  • strange behavior printing with shell.run
    ... If I go to the server and do a cmd line print ... Set oShell = CreateObject ... oShell.Run "NET USE LPT1: /d" ...
    (microsoft.public.scripting.wsh)
  • Re: Load Balancing Outgoing, its possible ?
    ... # - Enabling the specific NAT server for IPFW ... $cmd 10 allow ip from any to any ... $cmd deny ip from any to 127.0.0.0/8 ... # Interface facing Public Internet ...
    (freebsd-net)