Nm... rewrote that portion a different way to get around the problem. This is what ended up working...
Code:
Break On
If Len($day) = 1
$day = '0'+$day
Endif
$day = @MDAYNO
$Computers = GetObject("WinNT://n00b")
$Computers.filter = "Computer",""
$OutputFile = 'Bad Computer Names ('+@YEAR+' '+SubStr(@MONTH,1,3)+' '+$day+').csv'
$x = 0
$org = "aew","emdg","eamds","emsg","eces",
"econs","ecs","elrs","esfs","esvs",
"emxg","eamxs","emxs","amog","eog",
"efs","eoss","amu","eas"
If Exist(@ScriptDir + '\' + $OutputFile)
Del @ScriptDir + '\' + $OutputFile
Endif
If Open(1,@ScriptDir +"\"+ $OutputFile,5) = 0
for each $Computer in $Computers
If Instr($Computer.name,'-')
$cArr = Split($computer.name,"-")
If Ubound($cArr) <> 2
$ = WriteLine(1,$Computer.name+',not enough or too many hyphens' + @CRLF)
$x = $x + 1
Else
If Ascan($org,$cArr[0]) = -1
$ = WriteLine(1,$Computer.name+',incorrect first element' + @CRLF)
Endif
Endif
Else
$ = WriteLine(1,$Computer.name + @CRLF)
$x = $x + 1
Endif
next
Else
? "Error "+@ERROR+": "+@SERROR
Endif
$ = Close(1)
Thanx for the help though Les.