pat_smith1969
Fresh Scripter
Registered: 2005-04-19
Posts: 18
|
I think I was posting while you posted so I didnt see your reply until AFTER I posted my reply...
My current Syntax works GREAT.. Thank you.
Break On if not InContainer('OU=Servers,OU=Machines,DC=TIGR,DC=ORG', 'Computer')[0] If Not Incontainer('OU=Domain Controllers,DC=TIGR,DC=ORG', 'Computer')[0] Shell \\altiris\Express\pat.bat EndIF endif Function InContainer ($Container, $NameType) Dim $Container, $CurrentContainer, $NameType, $Name1, $Name2 select case $NameType = "Computer" $Name1 = "@Domain\@wksta$" case $NameType = "User" $Name1 = "@LDomain\@UserID" case 1 $Name1 = "" endselect if $Name1 <> "" $Name2 = TranslateName (3, "", 3, $Name1, 1) if $Name2[1] = 0 $CurrentContainer = substr($Name2[0], instr($Name2[0], ",")+1) select case $CurrentContainer=$Container $InContainer = 1, $Name2[1], $Name2[2] case instr($Name2[0], $Container) $InContainer = 2, $Name2[1], $Name2[2] case 1 $InContainer = 0, $Name2[1], $Name2[2] endselect else $InContainer = -2, $Name2[1], $Name2[2] endif else $InContainer = -1, 0, "" endif EndFunction
Function TranslateName ($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType) Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType Dim $NameTranslate, $ReturnName, $Error, $ErrorText $Error = 0 $ErrorText = "" $ReturnName = "" $NameTranslate = CREATEOBJECT ("NameTranslate") $Error = @error $ErrorText = @serror if $Error = 0 $NameTranslate.Init ($InitType, $BindName) $Error = @error $ErrorText = @serror if $Error = 0 $NameTranslate.Set ($LookupNameType, $LookupName) $Error = @error $ErrorText = @serror if $Error = 0 $ReturnName = $NameTranslate.Get($ReturnNameType) $Error = @error $ErrorText = @serror endif endif endif $TranslateName = $ReturnName, $Error, $ErrorText Endfunction Thank you for the reply about the [0] I have a VAGUE idea of what an array is and how to use them so your explanation is sufficient, IF I need to konw more I will do the suggested reading. Thanks again.
My last question is ... Is there an easy way to do a check of the PCNAME and an if statement based on that...
IF PCName <> "PatsPC-xp"
Also most of my programming experience is in the ASP world and I find the lack of a "Then" quite disconcerting
|