|
|
|||||||
Within my scipt, I need to run a command to check certain criteria within the registy and execute depending on the result. Only if the hostname is a specific server and if a specific key exsists with a specfic value do I want the .reg file to import. Below is an example of what I want but I'm unsure if this is correct termonology and I can't find any specific examples of this on the forum. The manual states another option READVALUE but I can't tell which one is the correct command. IF @WKSTA="TS_SERVER" IF READTYPE ("HKEY_CURRENT_USER\Software\Program\Value_Name", "Value_data") Shell "regedit /s" "\\servername\share\import.reg" ENDIF ENDIF Thanks in advance for any assistance. |
||||||||
|
|
|||||||
You're close 1. What version of KiXtart are you using? 2. What are the exact details (names/reasons) to check to verify if you want it to run ? You would use ReadValue if you're making a determination of the data from the registry. The Type only tells you the data type which I don't think is what you're looking for. . |
||||||||
|
|
|||||||
Your shell line is wrong. Shell 'regedit /s "\\servername\share\import.reg"' |
||||||||
|
|
|||||||
Thank you for your replies... I have edited the two lines to the correct ReadValue and Shell commands and edited the REG_SZ info to read a little clearer... IF @WKSTA="TS_SERVER" IF ReadValue ("HKEY_CURRENT_USER\Software\Program\UserName", "NONUSER") Shell 'regedit /s "\\servername\share\import.reg"' ENDIF ENDIF I am running the very latest version of Kixtart (KiX2010_453) and the Registry values that I am reading are REG_SZ and in relation to a peice of software on a Terminal Server. The software has been installed but requires configuring, per user, on their first login. Once configured, the kixtart commands are no longer required which is why I need to check the value of the registry key to determine whether it's the default entry or not. If so, then it will import a registry key but if it's not the default entry, kixtart will ignore the command and carry on with the script. This still requires a little intervention to get the software running once the user is logged in. Therefore, once I have the correct command formating, I could query the name of the user and import a pre-made .reg key based on their username and it would be fully configured. It's just I'm not sure I'm calling the commands correctly from the login script to either run the command if a registry is of a certain value or to ignore it and carry on with the rest of the script if it's not. Thanks again for any help. |
||||||||
|
|
|||||||
I am sooo close but when ever I test, I don't get the desired result. This is the code I have now... IF @WKSTA="TS-SERVER" $User=ReadValue('HKEY_CURRENT_USER\Software\GoldMine\GoldMine Link for Microsoft Outlook','GMUserName') If $User 'NONUSER' Shell 'regedit /s "\\MAIN-SERVER\Support\Goldmine\GISMO\GISMO.reg"' ?"GISMO Installed for " @userid Else ?"GISMO Already Installed for " @userid EndIf When I test this, the key imports fine when the value is set to NONUSER. However, if I change this value to USER1, within the registry and then run the script again, it still imports the .reg file. I want it to ignore the import .reg command if anything but NONUSER is the value of the key. What have I got wrong? |
||||||||
|
|
|||||||
(Untested) Code: IF @WKSTA="TS-SERVER" $User=ReadValue('HKEY_CURRENT_USER\Software\GoldMine\GoldMine Link for Microsoft Outlook','GMUserName') If $User='NONUSER' Shell 'regedit /s "\\MAIN-SERVER\Support\Goldmine\GISMO\GISMO.reg"' ?"GISMO Installed for " + @userid Else ?"GISMO Already Installed for " + @userid EndIf EndIf Looks like you were missing an "=" after If $user and an Endif at the end. |
||||||||
|
|
|||||||
Perfect! Works like a dream now. Thanks for your help. |
||||||||
|
|
|||||||
good |