Do not use on any
shared computer
August 29, 2008 05:16pm pdt
 
[x]
Attachment Details

Error: Expected Expression in Kix Script: Trying to Audit MAC Addresses

Tags: KiXtart, 2010.453, MAC Address Audit kix kixtart Windows
I need to audit the MAC addresses of every machine on my domain.  I'm trying to reduce the workload by automating the collection from as many machines as possible.  My solution for this is to try and create a KiX script to do the job, as my organisation already has KiX loaded on the logon servers.

However, my current script has an error when run of an Expected Expression on line 22.

Can someone either suggest where I'm going wrong, or an alternative script? Thanks!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
$kwVBPath=@CurDir + "\KiXGUI.dll"
$SleepTime=3
$ScripToExecute=Split("ScrFunc1,ScrFunc2,ScrFunc3,ScrFunc4,ScrFunc5",",")
$SOC=8
$DefHeight=20
 
Dim $RelMaxLwidth
;This text below will show the current user name and current full name of the user logging in.
If @inwin=2
  $Userid=@WUserID
Else
  $Userid=@UserID
EndIf
 
; First, we have to create the first handler. Note that you can also directly do this :
; $form=createobject("KiXGUI.Desktop").addform("name","caption",...)
 
$root=CreateObject("KiXGUI.Desktop")
 
;************************User Form
; Here we will create a form with user informations
$frmUser=$root.createform("frmUser","Current User / Username")
$frmUser.height=125
$frmUser.width=250
 
 
; It''s possible to use the parent property
$frmUser.Left=($frmUser.parent.width-$frmUser.width) / 2
 
; Or, if you have desktop in a variable, to use it instead
$frmUser.top=($root.height-$frmUser.height) / 2
 
 
$frmUser.ChangeSysMenu(1,1,0)
$frmUser.Moveable=0
$frmUser.ResizeAble=0
$=$frmUser.addlabel("lblUserN","Complete name",10,10+2,SizeoS("Complete name"),$DefHeight)
$RelMaxLwidth=$frmUser.controls("lblusern").width
 
; Here we''ll immediatly use the returned object to change one of his property. 
; With this syntax, no need to have a $= in front to catch the object, but you can''t use both of them in the same line
$frmUser.addtextbox("txtUserN","@fullname",10+2+$RelMaxLwidth,10,sizeoS(" "+@fullname),$DefHeight).locked=1
 
$=$frmUser.addlabel("lblUserL","Login",10+2,10+$DefHeight,$RelMaxLwidth,$DefHeight)
$frmUser.addtextbox("txtUserL","$Userid",10+2+$RelMaxLwidth,10+$DefHeight,SizeoS(" "+$Userid),$DefHeight).locked=1
 
$=$frmUser.addlabel("lblLserver","Logon Server",10+2,10+($DefHeight*3),$RelMaxLwidth,$DefHeight)
$frmUser.addtextbox("txtLserver","@LServer",10+2+$RelMaxLwidth,10+($DefHeight)*3,SizeoS(" "+@LServer),$DefHeight).locked=1
$frmUser.width=$frmUser.width+30
 
; Here we will create a form with a welcome text and current progress status
$frmMain=$root.createform("frmMain","User logging into domain: YOURDOMAINNAME",,,350,125)
$frmMain.Left=($frmMain.parent.width-$frmMain.width) / 2
$frmMain.top=($frmMain.parent.height-$frmMain.height) / 14
$frmMain.ChangeSysMenu(1,1,0)
$=$frmMain.addlabel("lblWelcome","Welcome to the @Domain domain"+Chr(10)+"Please wait while loading your profile",10,10,SizeoS("Please wait while loading your profile"),35,1)
$ProgressFull=$frmMain.addprogressbar("pbFull",30,60,$frmMain.width-(30*2),20,2)
; We have +1 for the fact Ubound is 0 based and Progress Bar is not.
$ProgressFull.maxprogress=Ubound($ScripToExecute)+2
 
For $i=1 to $root.count
  $root.forms($i).visible=1
Next
 
For $i=0 to Ubound($ScripToExecute)
  $ProgressFull.currentprogress=$ProgressFull.currentprogress+1
  $=Execute($ScripToExecute[$i])
Next
 
$ProgressFull.currentprogress=$ProgressFull.maxprogress
 
; A last sleep here, just to had a final look
Sleep 1
Exit()
 
;**************************************************************************
;			Functions and others
;**************************************************************************
 
; Function using $SOC to return a pixel lenght of a string
Function SizeoS($f_sString)
  $SizeoS=(Len($f_sString)*$soc)
EndFunction
 
; Instead of execute a script, we will replace them with a function for this example
Function ScrFunc1()
Dim $f_frmScr
  $f_frmScr=$Root.createform("frmScr1","Logging into network ...",,,350,$DefHeight*4)
  $f_frmScr.Left=($f_frmScr.parent.width-$f_frmScr.width) / 2
  $f_frmScr.top=($f_frmScr.parent.height / 8)+$f_frmScr.height
  $f_frmScr.changesysmenu(1,1,0)
  $f_frmScr.resizeable=0
  $f_frmScr.visible=1
 
  ; Needed, as even if the container variable is out of range, the object lives in 
  ; his parent''s collection and we don''t want the form to show when we don''t use it
  $f_frmScr.visible=0
EndFunction
 
Function ScrFunc2()
  Sleep 1
EndFunction
 
 
Function ScrFunc3()
  Sleep 1
EndFunction
 
 
Function ScrFunc4()
Dim $f_frmScr
Dim $f_pbDrive
  $f_frmScr=$Root.createform("frmScr4","Collecting Hardware Information ...",,,350,$DefHeight*4 )
  $f_frmScr.Left=($f_frmscr.parent.width-$f_frmScr.width) / 2
  $f_frmScr.top=($f_frmScr.parent.height / 8)+$f_frmScr.height
  $f_frmScr.changesysmenu(1,1,0)
  $f_frmScr.resizeable=0  
  $=$f_frmScr.addlabel("lblNet","Please wait while collecting hardware information ...",10,10,$f_frmScr.width-30,$DefHeight,1)
  $f_frmScr.Addprogressbar("pbDrive",10,10+$DefHeight,$f_frmScr.width-30,$DefHeight).maxprogress=(Ubound($NetDrives)+1)
  $f_frmScr.visible=1
  Sleep 1
    $f_frmScr.controls("lblnet").caption="Collecting Hardware Information"
 
; 1)  Basic computer info for reference
 
RedirectOutput ("C:\Inventory\@WKSTA.txt",1)
 
  ?"NetBIOS name = "@WKSTA
 
  ?"Last login by "@USERID
 
  ?"OS = "@PRODUCTTYPE" with "@CSD
 
  ?"Memory = "MemorySize(0)" MB"
 
  ?"Processor type is "@CPU
 
  ?"Processor speed is "@MHZ
 
  ?"IP address = "@IPADDRESS0
 
  ?"MAC address = "@ADDRESS
 
  ?"This information was gathered on "@DATE" at "@TIME
  
EndFunction
 
Function ScrFunc5()
  Sleep 1
EndFunction
 
;----------------------------------------------------------
RETURN ; Must be last line of file. Do not remove this line
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: OS
Question Asked By: Sjoram
Solution Provided By: Ryan_R
Participating Experts: 2
Solution Grade: A
Views: 11
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by Isorg
Expert Comment by Isorg:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by Ryan_R

Rank: Master

Accepted Solution by Ryan_R:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Ryan_R

Rank: Master

Expert Comment by Ryan_R:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628