#197622 - 2010-02-02 08:16 PM
If, And, Then..... how? Need Help Urgently please?
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
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
Edited by peacey (2010-02-02 08:16 PM)
|
Top
|
|
|
|
#197625 - 2010-02-02 08:28 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: peacey]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
You've done all the work... just need to use the manual to find the commands...
untested
If InGroup("Groupname")
if not Exist('A folder share')
MD "\\Servername\Sharename$\%username%"
endif
use P: "\\Servername\Sharename$\%username%"
endif
|
Top
|
|
|
|
#197637 - 2010-02-03 10:51 AM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: Allen]
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
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!
|
Top
|
|
|
|
#197639 - 2010-02-03 12:47 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: peacey]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
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,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. That way, you now each piece works and you test as you go along to make sure it works with everything else. If you try to write a large piece of code and then debug, it is much harder.
|
Top
|
|
|
|
#197640 - 2010-02-03 01:46 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: BradV]
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
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!
|
Top
|
|
|
|
#197641 - 2010-02-03 01:53 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: Allen]
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
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
Edited by peacey (2010-02-03 02:00 PM)
|
Top
|
|
|
|
#197646 - 2010-02-03 03:00 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: peacey]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
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
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#197647 - 2010-02-03 03:29 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: Glenn Barnas]
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
OK, sorry.... here it is:
; #######################################
; # 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
Edited by peacey (2010-02-03 03:36 PM)
|
Top
|
|
|
|
#197648 - 2010-02-03 03:33 PM
Re: If, And, Then..... how? Need Help Urgently please?
[Re: peacey]
|
peacey
Fresh Scripter
Registered: 2010-02-02
Posts: 20
Loc: Nottingham, UK
|
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
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 515 anonymous users online.
|
|
|