Page 1 of 2 12>
Topic Options
#168637 - 2006-09-30 01:54 AM using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
Simple kix script that is Pi$$ing me off. It appears that the if not exist kix function in 4.53 does not take unc's. It is always running this part of the code reguardless if the dir exist or not.
Code:

If Not Exist("\\" + @WKSTA + "\d$\kix\scripts")
MD "\\" + @WKSTA + "\d$\kix\scripts
EndIf


Top
#168638 - 2006-09-30 02:09 AM Re: using exist with unc not working
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It works for me to C$.

Have you tried simply typing the path in your run line? I'm guessing you foobar'd the path or there is no D$ share or the OS is getting in the way.

Top
#168639 - 2006-09-30 02:15 AM Re: using exist with unc not working
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Since you are using an admin share, just wondering, does the person running this script have admin permissions?

Second... since you are using @WKSTA that means you are connecting to the machine that the script is running on. Why use @wksta at all? for example:

Code:

If Not Exist("d:\kix\scripts\")
MD "d:\kix\scripts"
EndIf


Top
#168640 - 2006-09-30 03:54 AM Re: using exist with unc not working
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Please give this a try and let us know.


If GetFileAttr('\\' + @WKSTA + '\d'+'$'+'\kix\scripts') & 16
'Folder already exists - nothing to do' ?
'Folder checking error returned was: ' + @ERROR + ' - ' + @SERROR ?
Else
MD '\\' + @WKSTA + '\d'+'$'+'\kix\scripts'
'Folder not found - creating folder now...' ?
'Folder creation error returned was: ' + @ERROR + ' - ' + @SERROR ?
EndIf

Top
#168641 - 2006-09-30 08:55 AM Re: using exist with unc not working
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I have tried all kind of combinations and declarations, like
Code:

d$\kix\scripts = 5
$\kix\scripts = 6
$ = 7


They do not hurt the scipt.
This should work even without
Code:

Dim $RC
$RC = SetOption("NoVarsInStrings","On")


So I also presume jconway is using this for non admin users, p.e. during logon?

Top
#168642 - 2006-09-30 01:06 PM Re: using exist with unc not working
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
single $ is not interpreted inside strings since some 4.1x or something.
Top
#168643 - 2006-09-30 05:18 PM Re: using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
thanks for all the replies. I am the Administrator for this process. This is just a stupid little script we use to copy all of our logon scripts to all of our > 300 Terminal servers. The reason I need to use the @WKSTA macro is due to how we deploy the script. We use the citrix installer available to us. It allows us to have simple scripts that don't need to enumerate all the servers. I will try the suggestions given on Monday. I will keep all posted.
Top
#168644 - 2006-10-02 11:39 PM Re: using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
got the script working. Had to change the d$ to d$$ for it to work.
Top
#168645 - 2006-10-03 01:02 AM Re: using exist with unc not working
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Using this at the top of your script will prevent that and is considered best practice to use for scripting.

Code:
If Not @LogonMode
Break On
EndIf
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')


Top
#168646 - 2006-10-03 04:00 AM Re: using exist with unc not working
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Or upgrade KiX.
Top
#168647 - 2006-10-03 05:34 AM Re: using exist with unc not working
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Yes, but there have been so many posts of recent that spent a day or two of back and forth posting that ended up being due to script errors that using that type of header would have alerted the user right away to their code errors instead of the community spending time debugging their script.
Top
#168648 - 2006-10-05 01:47 AM Re: using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
using latest version available.
Top
#168649 - 2006-10-05 02:38 AM Re: using exist with unc not working
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

using latest version available.



Then there is no way you should have to double up the $. You must have changed something else.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#168650 - 2006-10-05 02:39 AM Re: using exist with unc not working
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Probably the missing quote on the end of this line:

MD "\\" + @WKSTA + "\d$\kix\scripts

Top
#168651 - 2006-10-05 10:27 AM Re: using exist with unc not working
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol.
Top
#168652 - 2006-10-05 10:32 AM Re: using exist with unc not working
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Aaaaaargh, have we been blind?
Top
#168653 - 2006-10-05 12:37 PM Re: using exist with unc not working
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well the code I provided does not have that issue and it checks for a folder not a file.

His method will find (if working) either file or folder by that name.

But I guess he didn't want to try my version.

Top
#168654 - 2006-10-10 10:35 PM Re: using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
na that weren't it. Trully, the only change was to add the double $. No the quote at the end was there, just a copy past thing.
Top
#168655 - 2006-10-10 10:41 PM Re: using exist with unc not working
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, you actually saying that you changed nothing and it suddenly started working?
Top
#168656 - 2006-10-11 05:29 PM Re: using exist with unc not working
jconway Offline
Fresh Scripter

Registered: 2002-02-26
Posts: 16
no I changed the d$ to d$$ to get it to work. That is all I did. Honest
Top
Page 1 of 2 12>


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

Who's Online
0 registered and 318 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.072 seconds in which 0.023 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