Got a kix issue I'm hoping yall can help me with. I have a working script the goes through AD checking last logon time stamps and output anyone over 30 days to multiple excel .CSV files. What I'm trying to do is make it output to a single .CSV file except in multiple tabs. This is actually the first time I've worked with kix, I have some experience with VBScript, and I'm just working through a script I was given. I've tried messing with some of the UDF files listed on this site, didn't have much luck, I assume I'm not creating some of the objects needed.

Anyway, here is a section of the code:

SetConsole("hide")

Break On
call @ScriptDir + "\xlLib.udf"

If Exist ("c:\LastLogon")
Goto skip
EndIf
MD "c:\LastLogon"
:skip
MD "c:\LastLogon\30_Days"
MD "c:\LastLogon\30_Days\11"


Select
Case @MONTHNO = 1
$Month = 12
Goto month
Case @MONTHNO = 2
$Month = 1
Goto month
Case @MONTHNO = 3
$Month = 2
Goto month
Case @MONTHNO = 4
$Month = 3
Goto month
Case @MONTHNO = 5
$Month = 4
Goto month
Case @MONTHNO = 6
$Month = 5
Goto month
Case @MONTHNO = 7
$Month = 6
Goto month
Case @MONTHNO = 8
$Month = 7
Goto month
Case @MONTHNO = 9
$Month = 8
Goto month
Case @MONTHNO = 10
$Month = 9
Goto month
Case @MONTHNO = 11
$Month = 10
Goto month
Case @MONTHNO = 12
$Month = 11
Goto month
EndSelect
:month


$Domain = "DC=domain,DC=com"
$var1 = '"&(objectcategory=person)(!(DormantAcctExempt=*))(lastLogonTimestamp>={{LOCAL:1601/01/01}})(lastLogonTimestamp<={{LOCAL:@year/$month/@mdayno}})"'
$var2 = "samAccountName sn givenName title Department TelephoneNumber lastLogonTimestamp"





;****************;
; 11 ;
;****************;


;11-Staff
Shell "%comspec% /c adfind.exe -b OU=11-STAFF,OU=11,$Domain -csv -nodn -nocsvheader -tdcs -binenc -f $var1 $var2 > c:\LastLogon\30_Days\11\11-Staff.csv"

;611A
Shell "%comspec% /c adfind.exe -b OU=611A,OU=11,$Domain -csv -nodn -nocsvheader -tdcs -binenc -f $var1 $var2 > c:\LastLogon\30_Days\11\611A.csv"

;611B
Shell "%comspec% /c adfind.exe -b OU=611B,OU=11,$Domain -csv -nodn -nocsvheader -tdcs -binenc -f $var1 $var2 > c:\LastLogon\30_Days\11\611B.csv"