Page 1 of 2 12>
Topic Options
#62600 - 2002-01-31 05:44 PM my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Hi,

I'm stuck with the following situation;

In my main script there is this line:
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "OutlookSettings"," run \\server\outlook2000$\OutlookSettings.bat", "REG_SZ" )

This works. It seems be carried out during the next login. But it doesn't do anything.
If I carried out the batchfile manually then it's fine.

This is the content of OutlookSettings.bat:
Z:\Kix32.exe %0\..\OutlookSettings.kix $ZKey=%1


I appreciate any help, thanks.

[ 31 January 2002: Message edited by: bonC ]

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62601 - 2002-01-31 05:58 PM Re: my runonce key no good?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
BonC -
Try changing this:
" run \\server\outlook2000$\OutlookSettings.bat"

to this:

"%comspec% /c \\server\outlook2000$\OutlookSettings.bat"

or perhaps this:
"START \\server\outlook2000$\OutlookSettings.bat

Run is not a Windows command, but a KiX command. You are running this item outside of KiX and strictly in Windows environment.

Bill

Top
#62602 - 2002-01-31 06:02 PM Re: my runonce key no good?
Fluke Offline
Fresh Scripter

Registered: 2001-12-19
Posts: 5
Loc: UK
Beat me to it by a second or two.

I've just tested this on NT4 workstation

You can get away with just removing the word "run" so the following line of code works nicely.

code:
WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "OutlookSettings","\\Server1\outlook2000$\OutlookSettings.bat", "REG_SZ" ) 

Hope that helps,

_________________________
Fluke! Don't take life too seriously... it ain't permanent! Attributed to Joe Pearlstein.

Top
#62603 - 2002-01-31 06:15 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Unfortunately no good luck yet.

I've tried the %comspec% cmd /c, start and without. None works in my case.

Thanks in advanced.

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62604 - 2002-01-31 06:19 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Maybe it will help if I post the full code?

It's about outlooksettings.kix which is triggered by the outlooksettings.bat.

=========================
Outlooksettings.bat:

Kix32.exe %0\..\OutlookSettings.kix $ZKey=%1

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

OutlookSettings.kix:

SetConsole("HIDE")

; Determine driveletter and path of the installationsource
$zkey = ReadProfileString(@LDrive + "\test.ini","mailid","%username%")
$Scriptspath = @CURDIR

$ApplyPolicy = ReadProfileString("$Scriptspath\OutlookInstall.ini", "Policy", "Apply")

; Write the username to the registry so that the name is already filled in when logging
; on to Exchange
$x = AddKey ("HKEY_CURRENT_USER\Software\Microsoft\Exchange")
$x = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Exchange", "UserName", $ZKey, "REG_SZ")

; Perform an LDAP query to get to learn the Usermailbox and the Exchangeserver of the user
; that is currently logged on .
cd "$Scriptspath"
$Query = "LdapQ.bat $ZKey"
Shell $Query

;profile aanmaken
cd "$Scriptspath\ing\profile"
$Prof = "kix32.exe profile.kix"
Shell $Prof

;policy (depends on the setting)
if $ApplyPolicy = "yes"
cd "$Scriptspath\ing\registry"
$Pol = "Regedit /s Outlook.reg"
Shell $Pol
EndIf

; Set Outlook 'Logon network security' to 'None'
$OS = @INWIN
If $OS = 1
cd "$Scriptspath\ing\Authentication"
$LogNetSec = "Regedit /s Authentication.reg"
Shell $LogNetSec
Else
cd "$Scriptspath\ing\Authentication"
$LogNetSec = "Regedit /s Authentication98.reg"
Shell $LogNetSec
EndIf

;shortcuts weg
if $OS = 1 ; Windows NT

$OutlookExpr="%USERPROFILE%\Start Menu\Programs\Outlook Express.lnk"
Shell "%SYSTEMROOT%\System32\attrib.exe -r -s -h " + $OulookExpr
del $OutlookExpr

$ConnWizard="%USERPROFILE%\Start Menu\Programs\Accessories\Communications\Internet Connection Wizard.lnk"
Shell "C:\Windows\Command\attrib.exe -r -s -h " + $ConnWizard
del $ConnWizard

else ; Windows 9x

$OutExpress = "C:\windows\Start Menu\Programs\Outlook Express.lnk"
$ShellCmd = 'C:\Windows\Command\attrib.exe -r -s -h "' + $OutExpress + '"'
Shell $Shellcmd
del $OutExpress

$LaunchOut = "C:\windows\application data\microsoft\internet explorer\quick launch\launch outlook express.lnk"
$ShellCmd = 'C:\Windows\Command\attrib.exe -r -s -h "' + $LaunchOut + '"'
Shell $ShellCmd
del $LaunchOut
endif

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

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62605 - 2002-01-31 06:22 PM Re: my runonce key no good?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Don't forget when using "$", it should be "$$".

Also in your bat, you are setting $ZKey=%1 but I don't see where you are passing %1.

[ 31 January 2002: Message edited by: LLigetfa ]

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#62606 - 2002-01-31 06:25 PM Re: my runonce key no good?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Bonc -
+ What O/S are clients trying to execute the batch file? And I assume no problems re: security rights to access the share?

+ Was this a typo: "I've tried the %comspec% cmd /c, start and without."? You would use either '%comspec% /c' or 'cmd /c', but not both on one line.

+ Does you batch file require a mapped drive to execute, versus UNC naming?

Bill

Top
#62607 - 2002-01-31 06:27 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
quote:
Don't forget when using "$", it should be "$$".

outlook2000$$ instead of outlook2000$ doesn't helped either.

I also tried to change the "@curdir" to UNC path and to drivemapping. No good also.

Thnx.

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62608 - 2002-01-31 06:34 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
quote:
Also in your bat, you are setting $ZKey=%1 but I don't see where you are passing %1.

It's in the 3rd line of OutlookSettings.kix;
$zkey = ReadProfileString(@LDrive + "\test.ini","mailid","%username%")


Bleonard:
- it's on NT4.0 wks, the permission share is read and the NTFS I've changed to change from read.
- oops, it wasn't a typo. But I just give a go again with only %comspec% /c but no go either.
- I guess it's not necessary, cause when I doubleclicked on it it will do the job.

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62609 - 2002-01-31 06:38 PM Re: my runonce key no good?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
BonC -
Okay, lets step back a moment.

Has this batch file and script ever worked? If so, in what manner? Have you run the script in dubug mode to watch results? There are no routines to handle failure states in your script, so very difficult to troubleshoot on this board. When $Scriptspath = @CURDIR, what value is returned during the login script execution, and is this in fact where the scripts are located? And are the references to 'C:\Windows' and '%UserProfile%' accurate for all workstations and O/S's on your network?


Bill

Top
#62610 - 2002-01-31 06:44 PM Re: my runonce key no good?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I can go to same direction in my comments as bleonard.
you can test the runonce with fake.bat in the c:-drive and make that bat include only:
echo it works
pause

then point to it to know is the problem runonce or script related.

cheers,

_________________________
!

download KiXnet

Top
#62611 - 2002-01-31 06:46 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Bleonard:

It works when OutlookSettings.kix is carried out manually.

@curdir was indeed the trouble I posted earlier in my ever first posting here today. I solved it by replacing it with this:
$installsource = "\\server\Outlook2000$"
USE Z: /delete
USE Z: $installsource
@curdir = $installsource
$Scriptspath = "Z:"

Maybe it's better if I post it the whole story in the next one, cause I've been struggling with it for the last 2 days and I'm very tired now

Tnx.

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62612 - 2002-01-31 06:52 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
First step:


It's about these 6 scripts (3 batch files which trigger 3 corresponding 3 kix files:

step 1:
OutlookInstall.bat

content:
kix32.exe %0\..\OutlookInstall.kix


OutlookInstall.kix

content:
BREAK ON
; Is there an alternative installdirectory?
$Installdir = ReadProfileString("%0\..\OutlookInstall.ini", "InstallDirectory", "dir")

If LEN($Installdir) > 0
$InstallDrive = Substr($Installdir, 1, 3)

; Is there enough on disk ( > 160000 KB)?
$Result = Getdiskspace( $InstallDrive )
If $Result < 160000
goto FOUT
EndIf

; If there is an alternative installdirectory, use it to create an extra commandline option.
$Directory = ' INSTALLLOCATION="' + $InstallDir + '" '

Else
; Is there enough on disk ( > 160000 KB)?
$Result = Getdiskspace( "C:\" )
If $Result < 160000
goto FOUT
EndIf

; No extra commandline option is needed.
$Directory = ""

EndIf

; installation of Outlook
; Determine OS version
$OS = @INWIN

; Determine driveletter of installationsource
; $Drive = Substr(@CURDIR, 1, 2)
$Scriptspath = @CURDIR

; Build the install instruction depending on the OS version.
if $OS = 1 ; Windows NT
$install = $Scriptspath + '\setupprm.exe TRANSFORMS="' + $Scriptspath + '\Ing\Mst\OutlookPremium.mst"' + $Directory + ' /qn'
; $install = $Scriptspath + '\setupprm.exe TRANSFORMS="' + $Scriptspath + '\Ing\Mst\OutlookPremiumNoIE.mst"' + $Directory + ' /qn'
else ; Windows 9x
$install = $Scriptspath + '\setupprm.exe TRANSFORMS="' + $Scriptspath + '\Ing\Mst\W98OutlookPremium.mst"' + $Directory + ' /qn'
endif

;Start the actual installation
Shell $install

; Code to write ING-Version to the registry. Version is kept in the file 'Version.ini'
; in the root of the CD or installation share.
$Version = ReadProfileString ($Scriptspath + "\Version.ini", "Outlook2000", "Version")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Ing")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Ing\SoftDist")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Ing\SoftDist\Outlook2000")
$x = WriteValue("HKEY_LOCAL_MACHINE\Software\Ing\SoftDist\Outlook2000", "Version", $Version, "REG_SZ")


; Code to display some kind of progress indicator to show that install is still running.
Dim $Progress[4]
$Progress[0] = "-"
$Progress[1] = "\"
$Progress[2] = "|"
$Progress[3] = "/"
$Tel = 0

:WaitForReboot
; This part will only stop when a reboot occurs or after we waited 10 minutes
If $Counter > 600 ; we waited 600 * 1 second = 10 minutes
Goto END
Endif
cls
$Tel = $Tel + 1
if $Tel = 4
$Tel = 0
EndIf

?
?
? " Now installing Outlook 2000."
? " Please wait for a reboot."
?
? " Installing: " + $Progress[$Tel]

$Counter = $Counter + 1
Sleep 1

Goto WaitForReboot


:FOUT
? "****************************************************************************"
? "* *"
? "* This workstation has not enough space available to install Outlook 2000. *"
? "* 160 Mb is needed to install. Free some space and try again. *"
? "* *"
? "****************************************************************************"

:END
Cls
?
? " Ten minutes have passed since the installation was started."
? " The installation should be finished by now. Probably there "
? " was no need for a reboot. "
?
? " Please check if the installation process has finished. Use the Task Manager "
? " to see if there is just one process called 'msiexec.exe'. If there are three "
? " processes called 'msiexec.exe', than the installation is not finished. "
?
? " Press any key to close this window... "
Get $x

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62613 - 2002-01-31 06:54 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Step 2:

cleanup.bat

content:
kix32.exe %0\..\Cleanup.kix


cleanup.kix

content:
SetConsole("HIDE")

; Determine driveletter and path of the installationsource
$Scriptspath = @CURDIR

$RmNetmeeting = ReadProfileString("$Scriptspath\OutlookInstall.ini", "Netmeeting", "Remove")
; Remove Netmeeting (depends on the setting)
if $RMNetmeeting = "yes"
cd "$Scriptspath\ing\Netmeeting"
$RmNetmtg = "kix32.exe RmNetmtg.kix"
Shell $RmNetmtg
EndIf

;Remove Welcome message
cd "$Scriptspath\ing\RmWelcome"
$RmWlcm = "kix32.exe RmWelcome.kix"
Shell $RmWlcm

; Copy Outlookbar info to the correct directory.

$Installdir = ReadProfileString("$Scriptspath\OutlookInstall.ini", "InstallDirectory", "dir")
If LEN($Installdir) > 0
$InstallDrive = Substr($Installdir, 1, 3)
Else
$InstallDrive = "C:\program files\Microsoft Office\"
EndIf

$cmd1 = $Scriptspath + "ing\Extra\Outlbar.inf"
$cmd2 = $InstallDrive + "Office\1033\outlbar.inf"

Copy $cmd1 $cmd2

; Add four registry keys that make up the machinesettings of the Outlook Policy

$command = "regedit /s $Scriptspath\ing\Extra\machinesettings.reg"
Shell $command

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62614 - 2002-01-31 06:56 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Step 3:


OutlookSettings.bat

content:
Kix32 %0\..\OutlookSettings.kix $ZKey=%1


OutlookSettings.kix

content:
SetConsole("HIDE")

; Determine driveletter and path of the installationsource
$Scriptspath = @CURDIR

$ApplyPolicy = ReadProfileString("$Scriptspath\OutlookInstall.ini", "Policy", "Apply")

; Write the username to the registry so that the name is already filled in when logging
; on to Exchange
$x = AddKey ("HKEY_CURRENT_USER\Software\Microsoft\Exchange")
$x = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Exchange", "UserName", $ZKey, "REG_SZ")

; Perform an LDAP query to get to learn the Usermailbox and the Exchangeserver of the user
; that is currently logged on .
cd "$Scriptspath"
$Query = "LdapQ.bat $ZKey"
Shell $Query

;profile aanmaken
cd "$Scriptspath\ing\profile"
$Prof = "kix32.exe profile.kix"
Shell $Prof

;policy (depends on the setting)
if $ApplyPolicy = "yes"
cd "$Scriptspath\ing\registry"
$Pol = "Regedit /s Outlook.reg"
Shell $Pol
EndIf

; Set Outlook 'Logon network security' to 'None'
$OS = @INWIN
If $OS = 1
cd "$Scriptspath\ing\Authentication"
$LogNetSec = "Regedit /s Authentication.reg"
Shell $LogNetSec
Else
cd "$Scriptspath\ing\Authentication"
$LogNetSec = "Regedit /s Authentication98.reg"
Shell $LogNetSec
EndIf

;shortcuts weg
if $OS = 1 ; Windows NT

$OutlookExpr="%USERPROFILE%\Start Menu\Programs\Outlook Express.lnk"
Shell "%SYSTEMROOT%\System32\attrib.exe -r -s -h " + $OulookExpr
del $OutlookExpr

$ConnWizard="%USERPROFILE%\Start Menu\Programs\Accessories\Communications\Internet Connection Wizard.lnk"
Shell "C:\Windows\Command\attrib.exe -r -s -h " + $ConnWizard
del $ConnWizard

else ; Windows 9x

$OutExpress = "C:\windows\Start Menu\Programs\Outlook Express.lnk"
$ShellCmd = 'C:\Windows\Command\attrib.exe -r -s -h "' + $OutExpress + '"'
Shell $Shellcmd
del $OutExpress

$LaunchOut = "C:\windows\application data\microsoft\internet explorer\quick launch\launch outlook express.lnk"
$ShellCmd = 'C:\Windows\Command\attrib.exe -r -s -h "' + $LaunchOut + '"'
Shell $ShellCmd
del $LaunchOut
endif

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62615 - 2002-01-31 07:02 PM Re: my runonce key no good?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
bonC,
please read my previous reply.
it makes everything easier if you test functionality part by part.
_________________________
!

download KiXnet

Top
#62616 - 2002-01-31 07:04 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
And I want to combine them all, triggered from the login script:

Something like this:

Login.kix

content:
; Check if Outlook 2000 is already installed on the machine

$ReturnCode = ExistKey("HKEY_LOCAL_MACHINE\Software\Company\SoftDist\Outlook2000")
If $ReturnCode
$Selection = MessageBox("It turns out Outlook 2000 has not been installed on your pc yet. Press 'OK' if you like to install it. This will take approximately 10 minutes.", "Outlook 2000 Installation", 36)
If $Selection = 6
$zkey = ReadProfileString(@LDrive + "\test.ini","mailid","%username%")
$installsource = "\\server\Outlook2000$"
USE Z: /delete
USE Z: $installsource

$Scriptspath = "Z:"
$install = $Scriptspath + '\setupprm.exe TRANSFORMS="' + $Scriptspath + '\Ing\Mst\OutlookPremium.mst"' + $Directory + ' /qn'

Shell $install

; RunOnce keys voor instellen van user's specifieke instellingen
; WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "Cleanup","\\a0930014\outlook2000$\kix32 \\a0930014\outlook2000$\cleanup.kix", "REG_SZ" )
; WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "OutlookSettings","\\a0930014\outlook2000$\kix32 \\a0930014\outlook2000$\outlookSettings.kix", "REG_SZ" )


; Code to write Company-Version to the registry. Version is kept in the file 'Version.ini'
; in the root of the CD or installation share.
$Version = ReadProfileString ($Scriptspath + "\Version.ini", "Outlook2000", "Version")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Company")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Company\SoftDist")
$x = AddKey ("HKEY_LOCAL_MACHINE\Software\Company\SoftDist\Outlook2000")
$x = WriteValue("HKEY_LOCAL_MACHINE\Software\Company\SoftDist\Outlook2000", "Version", $Version, "REG_SZ")

Get $x

WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "Cleanup"," run \\server\outlook2000$\Cleanup.bat", "REG_SZ" )
WRITEVALUE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "OutlookSettings"," run \\server\outlook2000$\OutlookSettings.bat", "REG_SZ" )

Endif
Else
goto end
Endif

:end

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62617 - 2002-01-31 07:08 PM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Lonkero:

That's what I do. I manage the first part; the installation.

Now I've been troubleshooting with only writing the 2 batch files to the 'runonce' key in apart script. But it won't do what it did when they are triggered manually.


Well, I've been on my work for more than 10 hours and I can't really see anything anymore. So sorry but I go home now. Tomorrow I will be back again.


Thanks. Bye.

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
#62618 - 2002-01-31 07:11 PM Re: my runonce key no good?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
BonC -
The intial start of each script, and in fact the entire process, is unclear to me, so I will pose this:

If this is all started from an entry in the RunOnce key, then perhaps an issue with the batch file calls is the culprit:

kix32.exe %0\..\OutlookInstall.kix
kix32.exe %0\..\Cleanup.kix
Kix32 %0\..\OutlookSettings.kix $ZKey=%1

In each command, the '0\..\' represents to KiX32.exe that the KiX script resides in the current directory. If executing from RunOnce, my guess is the current directory will be defined as being equal to '%windir%', generally 'C:\Windows' (though I do not know for a fact). If the KiX scripts do not reside here, they KiX32 attempted start of the script will fail.

You may be better off either mapping a temp drive, or using UNC notation, to specifically direct where to call the batch files to be run.

Bill

Top
#62619 - 2002-02-01 09:57 AM Re: my runonce key no good?
bonC Offline
Fresh Scripter

Registered: 2002-01-30
Posts: 18
Loc: The Netherlands
Bleonard, that rings a bell yeah...I'm all fresh and awake now

I've given some thought last night and have some ideas I'm gonna try now.

Later

_________________________
We should learn from the past... therefor nowadays we students know already the answers before the exam will be given...

Top
Page 1 of 2 12>


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

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

Generated in 0.073 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

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