Page 2 of 2 <12
Topic Options
#125301 - 2004-08-20 07:49 PM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
No changes to the udfs..

Other than the recommendation to change the PING Line, which seems to help.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125302 - 2004-08-20 08:15 PM Re: Having problems with Vars
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
obviously macieps last code does produce that error as it has no UDF included.
thus "unexpected command"
there is no such keyword in his last code.
_________________________
!

download KiXnet

Top
#125303 - 2004-08-20 08:50 PM Re: Having problems with Vars
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Jooel, i think it's safe to assume at this point that we all realize the udfs need to be there. i just didn't see any reason to repost them.
_________________________
Eric

Top
#125304 - 2004-08-20 09:08 PM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
He's just trying to increase his post count!!

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125305 - 2004-08-20 09:25 PM Re: Having problems with Vars
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Well, if we're looking at increasing our post count...

I notice that you're using an older version of WSHPipe, not that it should make any difference.

Top
#125306 - 2004-08-20 10:05 PM Re: Having problems with Vars
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, the error reported has a meaning.
and surely there is some silly reason for it, right kent?
_________________________
!

download KiXnet

Top
#125307 - 2004-08-21 01:09 AM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Sure the RDP Message seems to be the root of this. However, when I explicitly define a computer, it works fine.. But when I read in the list from Excel, AD, etc. is where this chokes.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125308 - 2004-08-21 01:22 AM Re: Having problems with Vars
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
have you tried the script without setoptions?
_________________________
!

download KiXnet

Top
#125309 - 2004-08-21 01:32 AM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Same error.. Same thing..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125310 - 2004-08-21 01:41 AM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I feel pretty stupid now.

Here is the corrected code.. You need to insure the computer is awake and ready, right?

Note: the $ip[1] check.
Code:

cls
break on

;DIM $oxl,$Row,$b,$ip,$make,$model,$sn,$cs,$mm,$mt,$,$u
;$rc=SETOPTION('Explicit','On')
;$rc=SETOPTION('NoVarsInStrings','On')

$oXL=Createobject('Excel.application')
;Check to insure that Excel is available
IF 0<>@error ?@error ' Excel Application is not found'
SLEEP 4
RETURN
ENDIF
$Rc=$oXL.workbooks.open(@scriptdir+'\Altiris.xls')
$Row=1 ;Row to start at using column headings, change to 0, if needed
WHILE $oXL.cells($Row,1).value<>'' ;need a value each time in column 1
$Row=$Row+1
IF $oXL.cells($Row,1).value='' ;Once it gets to a blank row...
$oXL.quit ;quit Excel
$oXL=0 ;set the object to 0
ELSE
$b=$oXL.cells($Row,1)
$ip=WSHPing($b)
IF $ip[1]>0
$u=WMIQuery("username","Win32_ComputerSystem",$b)
$make=WMIQuery("Manufacturer","Win32_ComputerSystem",$b)
$model=WMIQuery("Model","Win32_ComputerSystem",$b)
$sn=WMIQuery("SerialNumber","Win32_BIOS",$b)
$cs=WMIQuery("CurrentClockSpeed","Win32_Processor",$b)
$mm=WMIQuery("MonitorManufacturer","Win32_DesktopMonitor",$b)
$mt=WMIQuery("MonitorType","Win32_DesktopMonitor",$b)
?$b
?$ip[0]
?$u[0]
?$make[0]
?$model[0]
?$sn[0]
?$cs[0]
?$mm[0]
?$mt[0]
ENDIF
ENDIF
LOOP
?'process is complete'
get $



Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125311 - 2004-08-23 05:21 PM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Is there any way to detect if the is a machine off-line with this?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125312 - 2004-08-24 06:16 PM Re: Having problems with Vars
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here is what I have been able to put together on this:
Code:

CLS
BREAK ON

;DIM $oxl,$Row,$b,$ip,$make,$model,$sn,$cs,$mm,$mt,$,$u
;$rc=SETOPTION('Explicit','On')
;$rc=SETOPTION('NoVarsInStrings','On')
$fl='H:\mmc.csv'
IF exist($fl)
DEL $fl
ENDIF

$logdata='ComputerName,IP,User,Make,Model,Serial,Processor,Monitor,MonitorType'
LOGGER($fl,$logdata+@crlf)
$containername = @DOMAIN
$container = GetObject("WinNT://"+$containername)
$container.filter = "Computer", ""
FOR EACH $computer IN $container
$cn=$computer.name
IF LEFT($cn,4)='MMC0' AND LEN($cn)=8
IF RIGHT($cn,4)>=1300
$ip=WSHPing($cn)
?'checking '+$cn
SELECT CASE $ip[1]<0
$logdata=$cn+','$ip[0]
CASE NOT EXIST('\\'+$cn+'\admin$$')
$logdata=$cn+','$ip[0]
CASE EXIST('\\'+$cn+'\admin$$')
$u=WMIQuery("username","Win32_ComputerSystem",$cn)
$make=WMIQuery("Manufacturer","Win32_ComputerSystem",$cn)
$model=WMIQuery("Model","Win32_ComputerSystem",$cn)
$sn=WMIQuery("SerialNumber","Win32_BIOS",$cn)
$cs=WMIQuery("CurrentClockSpeed","Win32_Processor",$cn)
$mm=WMIQuery("MonitorManufacturer","Win32_DesktopMonitor",$cn)
$mt=WMIQuery("MonitorType","Win32_DesktopMonitor",$cn)
;?$cn
;?$ip[0]
;?$ip[1]
;?$u[0]
;?$make[0]
;?$model[0]
;?$sn[0]
;?$cs[0]
;?$mm[0]
;?$mt[0]
;ENDIF
$logdata=$cn+','+$ip[0]+','+$u[0]+','+$make[0]+','+$model[0]+','+$sn[0]+','+$cs[0]+','+$mm[0]+','+$mt[0]
ENDSELECT
LOGGER($fl,$logdata+@crlf)
ENDIF
ENDIF
NEXT
?'process is complete'
GET $



Requires:
WSHPING()
WSHPIPE()
LOGGER()
WMIQUERY()

Thanks!

Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 2 <12


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.145 seconds in which 0.081 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