Page 1 of 1 1
Topic Options
#63009 - 2002-02-11 05:28 PM MCA......... Help !!!!!
Anonymous
Unregistered


MCA,

Can you help me with the following script. I'm trying to push out via scriptlogic, an updated local security policy file, (localpolicy.inf). When I run it, I get the following error message (Error 3 copying file - the system cannot find the path specified). When I look into my registry, the affected key is UPDATED to the localpolicy.inf, however when I look at the local security settings on my PC, the file hasn't been updated. I deliberately changed one of the settings on my PC under maximum password age FROM 31 days TO 5 days to see if the script would make the change. (the localpolicy.inf file that I'm trying to copy to the user's PCs has the correct settings), but it's not being changed by the script. Any ideas?

=============================================


$Fil = "localpolicy.inf"
$Src = "\\Server Name\netlogon"
$Dst = WRITEVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit", "TemplateUsed", "\\Server Name\netlogon\localpolicy.inf", "REG_SZ")
$DstSize = GETFILESIZE ("$Dst\$Fil")
$DstTime = GETFILETIME ("$Dst\$Fil")
$SrcSize = GETFILESIZE ("$Src\$Fil")
$SrcTime = GETFILETIME ("$Src\$Fil")
IF EXIST ("$Dst\$Fil") = 0 ; REM ** File not found on client
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@ERROR = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
IF ($SrcSize <> $DstSize) OR ($SrcTime <> $DstTime)
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@ERROR = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
? "Verified file already exists on client"
ENDIF
ENDIF

Top
#63010 - 2002-02-11 05:36 PM Re: MCA......... Help !!!!!
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
My answer didn't help you, stan?
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=004107
_________________________
The Code is out there

Top
#63011 - 2002-02-11 06:21 PM Re: MCA......... Help !!!!!
Anonymous
Unregistered


Drill,

I've made the change you suggested and I'm still getting "Error 3 copying file (The system cannot find the path specified.)"
This is the exact same message I described earlier. Any further suggestions?

$Fil = "localpolicy.inf"
$Src = "\\Server Name\netlogon"
WRITEVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit", "TemplateUsed", "\\Server Name\netlogon\localpolicy.inf", "REG_SZ")
$DstSize = GETFILESIZE ("$Dst\$Fil")
$DstTime = GETFILETIME ("$Dst\$Fil")
$SrcSize = GETFILESIZE ("$Src\$Fil")
$SrcTime = GETFILETIME ("$Src\$Fil")
IF EXIST ("$Dst\$Fil") = 0
; REM ** File not found on client
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@ERROR = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
IF ($SrcSize <> $DstSize) OR ($SrcTime <> $DstTime)
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@ERROR = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
? "Verified file already exists on client"
ENDIF
ENDIF

Top
#63012 - 2002-02-12 03:06 AM Re: MCA......... Help !!!!!
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We have already answer your email. Following text has been returned:

A quick look at your script

code:

$fil = "localpolicy.inf"
$src = "\\F103003\netlogon"
$dst = WRITEVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit", "TemplateUsed",
"\\f103003\netlogon\localpolicy.inf", "REG_SZ")

$dstsize = GETFILESIZE ("$Dst\$Fil")
$dsttime = GETFILETIME ("$Dst\$Fil")
$srcsize = GETFILESIZE ("$Src\$Fil")
$srctime = GETFILETIME ("$Src\$Fil")
IF EXIST ("$Dst\$Fil") = 0 ; REM ** File not found on client
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@error = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
IF ($srcsize <> $dstsize) OR ($srctime <> $dsttime)
COPY "$Src\$Fil" "$Dst\$Fil"
IF (@error = 0)
? "Success copying file to client"
ELSE
? "Error @ERROR copying file (@SERROR)"
ENDIF
ELSE
? "Verified file already exists on client"
ENDIF
ENDIF



shows possible problem with the $dest. WriteValue will assign a number and not a filename to variable $dest.
Possible that it should be a ReadValue call.
F.e. specifies the actual destination for your testsystem and rerun your procedure for activating the localplociy.inf.

Still problems - possible a real ScriptLogic problem - we advice you to publish this problem on one of the forums of http://www.scriptlogic.com site also. Normally anything should be possible with ScriptLogic. We advice you to include the
"localpolicy.inf" contents too. Also specifies special configuration settings for your ScriptLogic program.
Please let us know the results.
greetings.

btw: we doesn't download your pictures. too much bytes for downloading. advice: send only compressed BMPs.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#63013 - 2002-02-12 05:43 PM Re: MCA......... Help !!!!!
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Stan -
I would also recommend looking at the designation for the source file location: \\ServerName\Netlogon

The Netlogon share is normally accessible with special security rights. It is possible that when accessing the share outside of the login process, it may be the users do not have rights to read/list files within the share. This can be the case even though the users properly login and execute a login script on the DC.

A simple test, of course, it to see if a regular user can drill into the NETLOGON share and see the files, and read their contents in some fashion.

Bill

Top
#63014 - 2002-02-13 12:46 AM Re: MCA......... Help !!!!!
Anonymous
Unregistered


MCA,

I've got the script to run from my desktop. (see attached script) Everything copies over from the localpolicy.inf file as it should and the files are updated. Two problems:

PROBLEM #1: How can I get this script to run on each users PC AFTER the logon process? We have several network drives and shared printers that are mapped during the logon process with scriptlogic. In order for my script to run successfully, it will need to execute AFTER the drives/printers have been mapped. It is possible to execute this script via a batch file?

PROBLEM #2: I only need the script to run ONCE. If the designated file already exists, how can I get the script to immediately go to the end and not run everytime?

=============================================

Dim $Index
CLS
$variable = ReadValue ("HKEY_LOCAL_MACHINE\SOFTWARE|Microsoft\Windows NT\CurrentVersion\SeCEdit\","TemplateUsed")
If $variable = "\\ServerName\netlogon\localpolicy.inf"
? "Revised security file exists."
goto skipfile
;Endif
;If $Returncode <> 0
Else
? "Revised security file not present. New file copied."
$Index = 0
$ReturnCode = SendKeys("^{ESC}")
$ReturnCode = SendKeys("R")
$ReturnCode = SendKeys("%systemroot%\system32\secpol.msc /s")
$ReturnCode = SendKeys("{ENTER}")
Sleep(2)
$ReturnCode = SendKeys("~A")
$ReturnCode = SendKeys("I")
$ReturnCode = SendKeys("\\ServerName\netlogon\localpolicy.inf")
$ReturnCode = SendKeys("{ENTER}")
$ReturnCode = SendKeys("~{F4}")
EndIF
:skipfile
?"End of Script"

Top
#63015 - 2002-02-13 03:40 AM Re: MCA......... Help !!!!!
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

From your main script you can start another script.
Some ideas:
- we are reading the registry value to verify the necessary of update security file.
OK, no script will be started.
- no sleep 60 necessary when it is possible within ScriptLogic to end its
logon process by starting a script.
sleep 60 can also verify the completion of mappings/printers settings.
- we have remove unused code.

f.e.

main script

code:

;
; - your code -
;
IF (ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit\","TemplateUsed") <> "\\ServerName\netlogon\localpolicy.inf")
RUN '%comspec% /c \\server\netlogon\kix32.exe \\server\netlogon\update_security_file.kix '
ENDIF
EXIT


Your update_security_file.kix can be
code:

SLEEP 60 ; - choice a period which is enough -
DIM $index
CLS
$variable=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit\","TemplateUsed")
IF $variable <> "\\ServerName\netlogon\localpolicy.inf"
? "Revised security file not present. New file copied."
$index=0
$returncode=SendKeys("^{ESC}")
$returncode=SendKeys("R")
$returncode=SendKeys("%systemroot%\system32\secpol.msc /s")
$returncode=SendKeys("{ENTER}")
SLEEP 2
$returncode=SendKeys("~A")
$returncode=SendKeys("I")
$returncode=SendKeys("\\ServerName\netlogon\localpolicy.inf")
$returncode=SendKeys("{ENTER}")
$returncode=SendKeys("~{F4}")
ENDIF
:skipfile
?"End of Script"


greetings.

btw: we doesn't see a COPY command in your latest script.

[ 17 February 2002: Message edited by: MCA ]

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#63016 - 2002-02-13 05:24 PM Re: MCA......... Help !!!!!
Anonymous
Unregistered


MCA,

Let me make sure I understand what you mean. Are you saying I can run both of the scripts that you mention within the same kix file OR should I run a separate file that calls up the second file? Here's what I'm attemtping to run.

I'm running the first portion of the script you posted as follows:

IF (Readvalue ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit\","TemplateUsed") <> "\\Server\netlogon\localpolicy.inf")
RUN '%comspec% /c \\Server\netlogon\kix32.exe \\Server\netlogon\update_security_file.kix '
ENDIF
EXIT


The above script should call up the second script, right? The second script (below)runs fine without the above script. Should these two script be ran together of separate? Could you post the ENTIRE script the way it should be ran? Thanks!


SLEEP 60 ; - choose a period which is enough
DIM $index
CLS
$variable=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SeCEdit\","TemplateUsed")
IF $variable <> "\\Server\netlogon\localpolicy.inf"
? "Revised security file not present. New file copied."
$index=0
$returncode=SendKeys("^{ESC}")
$returncode=SendKeys("R")
$returncode=SendKeys("%systemroot%\system32\secpol.msc /s")
$returncode=SendKeys("{ENTER}")
SLEEP 2
$returncode=SendKeys("~A")
$returncode=SendKeys("I")
$returncode=SendKeys("\\Server\netlogon\localpolicy.inf")
$returncode=SendKeys("{ENTER}")
$returncode=SendKeys("~{F4}")
ENDIF
:skipfile
?"End of Script"

Top
#63017 - 2002-02-17 06:35 AM Re: MCA......... Help !!!!!
Anonymous
Unregistered


MCA,

Can you post the ENTIRE script the way it should be ran?

Top
#63018 - 2002-02-18 07:42 PM Re: MCA......... Help !!!!!
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Our complete script is already included in earlier reactions.
Add following line to update_security_file.kix which will inform you
when second script is started.

code:

$null=MessageBox("script Update_Security_File.KIX starting","kixtart @kix info")


Second script should be called by first main.kix script.
Please return your results.
greetings.


btw: we still doesn't see a COPY command in your script.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

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 1283 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.081 seconds in which 0.055 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