Page 1 of 1 1
Topic Options
#135656 - 2005-03-15 10:21 PM startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
Hi all, this is my first post, so be gentle. I've been working w/kix now for about 6 months and have learned quite a bit about it... so here goes:

I'm trying to use an executable file to install a program on all of our client PCs here via a kix-script ran through a windows server 2k AD startup script onto XP and 2k clients. The relevant line of code is simply:

shell "\\server\install$$\setup.exe"

This is of course preceded by code that i KNOW works, but for some reason, when the code gets to the command above, the exe file is simply not ran. Is there some reason why the executable will not execute one some test runs, but will on others? Is there something I'm overlooking about the way startup scripts are processed? I'm using a startup script as opposed to a login script because our users are not administrators and do not have sufficient permissions to install softare. If I'm missing something please let me know, and perhaps maybe suggest a better way to do it. I've ruled out permissions on the file server, and also, the XP clients are set to wait for the network to fully initialize so that should not be an issue either. Please help, thanks.

Top
#135657 - 2005-03-15 10:33 PM Re: startup script from network resource
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Just how did you rule out any permissions issue?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135658 - 2005-03-16 12:33 AM Re: startup script from network resource
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Under which account does a start-up script run? Does a start-up script have the right to access network resources? Does the start-up script have the rights to access the hidden share? Why are you using the double '$'? If you would use SETOPTION('NoVarsInStrings','ON'), as is recomended, then the double '$' would not be necessary.

Oh, and this being the scripts forum we normally ask for script snippets, and not one-liner code fragments.
_________________________
There are two types of vessels, submarines and targets.

Top
#135659 - 2005-03-16 01:59 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
Permissions cannot be the issue because anything that's ran during a startup script uses the system permission level, and the permissions on the share are set to allow 'Everyone' read and execute access, so that's why I'm really doubting permissions as the issue. I hadn't read about the SETOPTION() function of kix, but will take full advantage of it now that I know... thanks. And for a look at the code see below, it just checks the registry, then runs the install:

setconsole("hide") ;hides the dos window


;array containing list of subnets to install on
;as we continue to add subnets, we'll still run on the other subnets that have already been ran on
;to ensure inclusion of everyone
$SUBNETS = "168", "169", "170", "171", "228", "229", "86", "221", "223"
;parses for each NIC on the machines that may have more than one NIC
For $NIC = 0 to 10

;if there is no information for the NIC, we've reached the end of available NICs
If EnumIPInfo ($NIC, 0) <> ""
;checks every subnet in the array until it finds the subnet of this NIC, or until the
;end of the array is reached without finding this NICs subnet
for each $SUBNET in $SUBNETS
if($SUBNET = "86") ;the substr function works differently since the 86 is a two-digit
;subnet
if((substr(EnumIPInfo($NIC,0),7 ,2)="86") and (substr(EnumIPInfo($NIC,0),9 ,1)="."))
commonTasks
endif

;works with all of the other 3 digit subnets
else
if(substr(EnumIPInfo($NIC,0),7 ,3)=$SUBNET)
commonTasks
endif
endif

next
EndIf


next

quit(1) ;machine is not to be included, so exit


;***************************************************************************
Function commonTasks

;check to see if it's already installed
$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_LOCAL_MACHINE\Software\", $Index)
If @ERROR = 0
;quits if the program has already been installed
if $KeyName = "LANDesk"
quit(1)
endif
$Index = $Index + 1
goto Loop1
Endif

;if we got here, the client is NOT installed already and must be installed
MessageBox("IT is installing new software. This could take up to 20 minutes depending on your machine speed, PLEASE BE PATIENT. "
+"You will be prompted to reboot upon completion of the install. "
+"If you wish to reboot, then click 'yes', if you do not, then click 'no'. "
+"If you click 'no' be sure that you do reboot sometime throughout the day. Thank you." , "Message from IT", 48)

;run the command to install MDAS
shell "\\fs2\install$$\mdas.exe"
quit(1)

EndFunction



****************END OF CODE************************

The funny part about it, is that I know the script is running for the test machines, but once it gets to that one line it does not run the executable. Some of the test machines run it and install just fine, while the others, receive the message box, and then that's it nothing more. And I've confirmed that the registry key that is used as the check does not exist on the machines that it is not working on. So that's the story, any more pointers would be appreciated. Thanks again.

Top
#135660 - 2005-03-16 04:59 PM Re: startup script from network resource
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well is the STARTUP script ran under the USER or under the MACHINE?

If under the MACHINE, then it has to be silent no user interaction or it will fail.

If under USER then the user has to have sufficient rights or it will fail.


Top
#135661 - 2005-03-16 05:08 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
The install is mostly silent, it just prompts the user for a restart after completion. And the permission level is under machine, it has to be, because since it's a startup script, it runs before a user is given a chance to login.
Top
#135662 - 2005-03-16 05:25 PM Re: startup script from network resource
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Quote:

it runs before a user is given a chance to login




Precisely... which, until you hit the built-in time out for a logon script the user has no way to interact with the script.

Think you should do some Microsoft and Google searches for Best Practices for Windows Startup Scripts. There is documentation out there to help show you what works and what doesn't, or what is problematic. Think finding that information would be more useful to help you accomplish your task.

Top
#135663 - 2005-03-16 05:29 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
Agreed. Appreciate the help.
Top
#135664 - 2005-03-16 05:34 PM Re: startup script from network resource
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I have experimented with startup GPO scripts and have been able to interact with them. What I have not tested is whether it can access a specific network share at that point. I would suggest that rather than assume it can, put some checks and logging in the script to remove all doubt. For example, try copying the file to a local folder and then see if it is there. There is also the possibility that the particular EXE requires a real user to be logged on.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135665 - 2005-03-16 07:52 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
I've been doing some experimenting all day today, and have found the following:

The .exe file does infact run at startup time, before the user is logged in just fine.

If I move the install file to the netlogon folder of one of our DCs then it runs every time, as it should

I think that for whatever reason, although I added the group "Domain Computers" to the ACL of the install$ share on the file server, that something is stopping the PCs from communicating w/that file server during startup time. I'm not really sure but I do know that it works from netlogon. So that is what I'm going with. Let me know if you have any more input. Thanks again.

marty

Top
#135666 - 2005-03-16 08:09 PM Re: startup script from network resource
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well I've done zero testing, but based on the fact of when this is happening I don't think the computer knows anything about any type of membership. i.e. It doesn't know it is part of Domain Computers I don't think. However EVERYONE means EVERYONE So you could give READ rights to EVERYONE just like the NETLOGON share has and see if it works or not.

Top
#135667 - 2005-03-16 08:31 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
That's how I had the install$ share setup originally on the file server, when I first posted. That was not the trick.
Top
#135668 - 2005-03-16 09:04 PM Re: startup script from network resource
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Did you double check SHARE and NTFS permissions both to make sure that EVERYONE had READ rights?

I know our Corporate boys run startup scripts for machines and point it directly to specific servers.

Another issue possibly. Are you sure the machine can find the specified share? We found some systems that could not find via WINS/DNS so they could not find the script to run. But this should show up in the Event Viewer too.

Top
#135669 - 2005-03-16 09:37 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
Yep, made sure both SHARE and NTFS permissions were set. As far as the machines not being able to find the share, I know that they can find it after login, but whether or not they can find it before login is questionalbe though. I did check the error logs on both the test client and the DCs but nothing jumped out and grabbed my attention. I'm sure that the .exe will always be found now, since now have it residing in netlogon.
Top
#135670 - 2005-03-17 01:12 AM Re: startup script from network resource
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Are you sure that the SYSTEM account has the right to access network resources, this right can be limited on the local computer. Make a test script that writes to a file on a network resource to test this.
_________________________
There are two types of vessels, submarines and targets.

Top
#135671 - 2005-03-17 01:23 AM Re: startup script from network resource
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I think M$ is doing something with smoke and mirrors in Netlogon to make it possible. Howard has confirmed that in AD, a startup script can in fact write to Netlogon. Now I wasn't sure, and never tested, if it holds true for any other share but this thread seems to bear out that Netlogon is "special".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135672 - 2005-03-17 02:07 PM Re: startup script from network resource
marticus Offline
Fresh Scripter

Registered: 2005-03-15
Posts: 12
I wrote a test script and tried to make a directory in the NETLOGON share, a normal file share, and a hidden file share... none of which were successful. I then planted dummy *.txt files in these locations and attempted to open them, none of which were successful either. I do know that it's possible to run .exe files from at least the netlogon share though, I've tested that on six different machines so far all of which were successful. Tests on running the .exe file during startup on the hidden file share were randomly successful. I think it's just a permission difference btw that share and netlogon.
Top
#135673 - 2005-03-17 07:03 PM Re: startup script from network resource
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well the NETLOGON share should not allow even your Admin account to create files. i.e it should be READ ONLY for all accounts.

Top
#135674 - 2005-03-19 12:48 AM Re: startup script from network resource
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Make your tests even simpler and ensure that the account used can even access network resources, e.g. ping to a network resource, or access an UNC for reading,...
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.081 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org