#125301 - 2004-08-20 07:49 PM
Re: Having problems with Vars
|
Kdyer
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
|
|
Top
|
|
|
|
#125304 - 2004-08-20 09:08 PM
Re: Having problems with Vars
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
He's just trying to increase his post count!!
Kent
|
|
Top
|
|
|
|
#125305 - 2004-08-20 09:25 PM
Re: Having problems with Vars
|
Chris S.
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
|
|
|
|
#125307 - 2004-08-21 01:09 AM
Re: Having problems with Vars
|
Kdyer
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
|
|
Top
|
|
|
|
#125309 - 2004-08-21 01:32 AM
Re: Having problems with Vars
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Same error.. Same thing..
Kent
|
|
Top
|
|
|
|
#125310 - 2004-08-21 01:41 AM
Re: Having problems with Vars
|
Kdyer
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
|
|
Top
|
|
|
|
#125311 - 2004-08-23 05:21 PM
Re: Having problems with Vars
|
Kdyer
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
|
|
Top
|
|
|
|
#125312 - 2004-08-24 06:16 PM
Re: Having problems with Vars
|
Kdyer
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
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1662 anonymous users online.
|
|
|