|
|
|||||||
Hi Guys, I'm brand new to scripting with Kix (Or with anything for that matter!) and I'm looking for some Syntax for the Following Logic If InGroup("Groupname") = 1 (AND - A folder does not exist within a share) > do > MD "\\Servername\Sharename$\%username%" Once MD has Finished then Map Drive. use P: "\\Servname\Sharename$\%username" If Folder Does Exist then Map Drive. use P: "\\Servname\Sharename$\%username" End Statement Can anybody help please???????? Peacey |
||||||||
|
|
|||||||
Welcome to KORG! There are a couple of ways to do this.. start with the basics Code: If Ingroup('groupname') If Not Exist('path\to\folder') ; in group but no folder - do stuff! ; make folder and map drive Else ; in group and folder exists - do different stuff ; just map drive EndIf ; folder exists EndIf ; in group xxx Glenn |
||||||||
|
|
|||||||
You've done all the work... just need to use the manual to find the commands... untested Code: If InGroup("Groupname") if not Exist('A folder share') MD "\\Servername\Sharename$\%username%" endif use P: "\\Servername\Sharename$\%username%" endif |
||||||||
|
|
|||||||
Guys... Thank you very much for the prompt and quick responses and welcoming me into your forum. I will go to work and test your code(s) in my master script which I am creating. I will let you know later how I get on! |
||||||||
|
|
|||||||
Since you are new to scripting, I would test it by itself first. In fact, you should test each piece by itself before joining to a larger script. So, Code: 1. Test code snippet 2. If it works, stick in main code. 3. If not, debug. 4. Test main code. 5. If it works, repeat with next code snippet. 6. If not, debug. |
||||||||
|
|
|||||||
Thankyou BradV for your Reply, so from now on then I will use this method for any future scripts. I use the Latest Version of KixStarter which is a great tool for building logon scripts ect... this method does work wonders and is easy to do! |
||||||||
|
|
|||||||
Guys.. again I can''t thank you enough for your help on this... it's a breath of fresh air to know there are people on this forum willing to help out where ever they can!.... I have applied allens code to my Script now that I know that it works! I do have one question and that is that although everything is working, Kixstart is kicking out a few errors within the event log. I get the Following: The network path was not found. (0x35/53). No mapping between account names and security IDs was done. (0x534/1332). The RPC server is unavailable. (0x6ba/1722). Very Strange! Peacey |
||||||||
|
|
|||||||
Two things - First, without seeing your code, we can't tell you what is causing the errors. We can guess at what COULD cause them, but that would not be as helpful. Post your script - just replace any Server or Domain references with generic "DOMAIN" and "SERVER-X" references. Second - I wrote a "Sanity" UDF that checks for commong programming errors - unpaired commands, quotes, parens, and undefined and duplicately defined variables. It also maps your code and creates a table of variable usage - all handy as your scripts grow in size. The easiest way to take advantage of the Sanity tool is through my KixDev package and the KGen tool. You can download this from my web site. Simply rename your script with a .txt extension and type KGEN SCRIPTNAME - it will scan the SCRIPTNAME.TXT file, (optionally resolve any UDF dependencies), and then run the sanity check. It will copy the .TXT to a .KIX file upon completion. This will greatly help in creating reliable code as well as help polish your coding skills. Glenn |
||||||||
|
|
|||||||
OK, sorry.... here it is: Code: ; ####################################### ; # Citrix Script for XenApp 5 # ; # Version 1.0 # ; # Script By Richard Peace # ; # Notes: N/A # ; ####################################### Select Case @INWIN = ("1") ;Windows NT ; ### Set variables to use for mapping main drives (Not Yet Used) ### ; If InGroup("GroupName") = 1 ; $fs="servername" ; $o="y" ; $ofs="servername" ; $p="servername" ; Endif ; ### Create Office 2003 Folder in User Home Drive if it does not exist ### If not Exist ("H:\office2003\") md "H:\Office2003" endif ; ### Create Office 2003 Folder in User Home Drive if it does not exist ### If not Exist ("H:\office2003\normal.dot") Shell "xcopy \\Servername\CTXScripts$\userprofile\Office2003\templates\*.* H:\office2003\*.*" endif ; ### Create Other Home Drive FOlders ### If not Exist ("H:\Bin") md "H:\Bin" endif If not Exist ("H:\Personal") md "H:\Personal" endif If not Exist ("H:\Temp") md "H:\temp" endif If not Exist ("H:\Work") md "H:\work" endif ; ### Site BU Shares ### If Ingroup("Groupname") = 1 Use U: /delete /persistent Use U: "\\Servername\sharename$" /persistent if not Exist('\\Servername\Sharename$\%username%') MD "\\Servername\Sharename$\%username%" endif Use P: /delete /persistent Use P: "\\Servername\sharename$\%username%" /persistent Endif If Ingroup("Groupname") = 1 Use U: /delete /persistent Use U: "\\Servername\share$" /persistent if not Exist('\\Servername\share$\%username%') MD "\\Servername\share$\%username%" endif Use P: /delete /persistent Use P: "\\Servername\share$\%username%" /persistent Endif If Ingroup("Groupname") = 1 Use U: /delete /persistent Use U: "\\Servername\share" /persistent Endif ; ### Dept Shares Shares ### If Ingroup("Groupname") = 1 Use G: /delete /persistent Use G: "\\Servername\share\dir" /persistent Endif If Ingroup("Groupname") = 1 Use G: /delete /persistent Use G: "\\Servername\share\dir" /persistent Endif If Ingroup("Grouname") = 1 Use G: /delete /persistent Use G: "\\Servername\share\dir" /persistent Endif ; ### IBM Client Access Reg Var ### $HKCUIBM="HKEY_Current_User\Software\IBM\Personal Communications\CurrentVersion\Preferences" $HKCUIBMprofile="HKCU\Software\IBM\Personal Communications\CurrentVersion\Preferences" ; ### IBM Client Access Reg changes ### If Ingroup("Groupname") = 1 WriteValue($HKCUIBM, "Path Type", "00000003", "REG_DWORD") WriteValue($HKCUIBM, "Profile Directory", "H:\WORK", "REG_SZ") Endif EndSelect Thank you. I'll have a look into your sanity script! I would like to Extend the Creation of the P:\ drive folder so that it Set's the user and Domain / Local ADMin ACL's. Peacey |
||||||||
|
|
|||||||
Could someone talk me though using variables in the most simplistic form please? I kind of understand that it's like calling Somthing = something else but i Still quite don't understand the logic of grouping variables and stuff! Peacey |
||||||||
|
|
|||||||
Take a look at my Intro to Programming PDF file. I use this when I teach admin scripting to non-programmers. It might answer some questions. The concepts and examples are generic, but the exercises use Kix. Glenn |