#92676 - 2003-08-25 01:35 AM
Array of Variants -- VarType Error
|
The Chef
Fresh Scripter
Registered: 2003-01-08
Posts: 23
Loc: New Jersey
|
Hi guys,
Has anyone messed with SMS Variant Arrays returned by WMI? I can't seem to figure this out:
$Resource = GetObject("winmgmts:\\{server}\root\sms\site_{site}:SMS_R_System.ResourceID=258") ? @SERROR ? VarType($Resource.IPAddresses)
Produces this output:
---------------------------- The operation completed successfully.
ERROR : invalid method/function call: missing ')'! Script: C:\Scripting\SMS Scripts\WMI Resource Records.kix Line : 3 ----------------------------
And this code:
$Resource = GetObject("winmgmts:\\{server}\root\sms\site_{site}:SMS_R_System.ResourceID=258") ? @SERROR ? Cstr($Resource.IPAddresses)
Produces this result:
-------------------------------------------- The operation completed successfully.
ERROR : Error in expression: this type of array not supported in expressions.! Script: C:\Scripting\SMS Scripts\WMI Resource Records.kix Line : 3 ---------------------------------------------
The call to WMI should be returning an array of variants, but kix can't seem to understand...
Microsoft suggests using a function to convert in this instance, but I cannot find the function or how to do it in Kix. See http://msdn.microsoft.com/library/en-us/sms/hh/sms/usingsms_850l.asp
Please help!
|
|
Top
|
|
|
|
#92678 - 2003-08-25 02:14 AM
Re: Array of Variants -- VarType Error
|
The Chef
Fresh Scripter
Registered: 2003-01-08
Posts: 23
Loc: New Jersey
|
I tried that with the Cstr and the results were the same. With VarType, it is able to return the expected 8204. Still, I need to convert to string..
|
|
Top
|
|
|
|
#92680 - 2003-08-25 02:27 AM
Re: Array of Variants -- VarType Error
|
The Chef
Fresh Scripter
Registered: 2003-01-08
Posts: 23
Loc: New Jersey
|
Oh man, you are right!! I feel like a fool. Anyway, despite all my mumbling about the stupid questions, I've gone and done it myself. I think I need to take break and sleep, but I want to thank you for dealing with my sleep-deprived mental state.
You sir, are a gentleman and a scholar, and your good-manners are only exceeded by your extreme generosity.
~The Chef (been codeing for too long)
|
|
Top
|
|
|
|
#92681 - 2003-08-25 02:34 AM
Re: Array of Variants -- VarType Error
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Well, you are the Chef after all. One can only hope that your cooking up a tasty gourmet script and will share it with the rest of us when your done
|
|
Top
|
|
|
|
#92682 - 2003-08-25 03:14 AM
Re: Array of Variants -- VarType Error
|
The Chef
Fresh Scripter
Registered: 2003-01-08
Posts: 23
Loc: New Jersey
|
Well, I have a bunch of admin scripts, only thing is: I dont want to waste space on the board posting stuff that has already been done. My best stuff has to do with AD domain cleanup and administration, while limited by NetIQ DRA permissions. I also created a neat package that remotely migrates computers across NT domains or from an NT domain to a 2k domain. Hmm.. what else... local administrative users administration from a central computer? Oh, I have a nice logon script that moves clients around under different Norton Managed servers based on computername or LDAP path. Nothing really unique or spectacular -- I only have time to solve the problems I am running into with custom solutions. What type of stuff are you guys looking for?
Tell you what, the reason I am writing this script is because I need a way to generate SMS DDR records that contain a custom property specifying the LDAP location of a computer object. That way, I can code collections to mirror AD, allowing my administrators to apply software packages to specific structures in my organization. We just stood up SMS 2.0, and until the upgrade to SMS 2003, there is no real way to do this. Microsoft has a special VB tool for example purposes to do this, but it only creates a DDR with the LDAP specific property, and I would like a code that would comprehensively query AD for computers, check the passwordage value to determine that the computer account is not orphaned, query DHCP for the subnet and IP, query DNS to make sure that the dynamic entry is correct, then check with SMS to determine whether or not this computer has been discovered yet or not. If discovered, merely modify the existing DDR, and update with all the appropriate properties, if not, create a unique DDR, then initiate remote client installation (if the bandwidth at the time is adequet).
There are lots of ways to go about solving this problem, and I am a bit swamped with other administration work, so I appreciate your help with my brain-fart.
I am not sure how much help code like that would be to your readers, but I am willing to post it when I am done if you would like..
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 675 anonymous users online.
|
|
|