Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Conditions using Tokens

Updated: 21 May 2010 | 5 comments
spazzzen's picture
0 0 Votes
Login to vote

I am trying to use a conditions that contains tokens.  I found this but what I have done seams like it should work.  Here are the specifics.  I am trying to create a job that does not allow a person to rename the computer if the name in the console already matches the computer name.  So I created a job that has a conditions of Name is exactly %COMPNAME%.  I have even tried the reverse Computer Name is exactly %NAME%.  That did not work either.  It keeps running the default script.  I have even set the name in the console to see if i can match the computer name but no luck.  Is it not possible to do this?

I would prefer to do this as a condition because I already have 10 conditions for the job I ultimately need this for.

Comments

Don Rowland's picture
26
Aug
2009
2 Votes 0
Login to vote

Conditions using Tokens

What you have stated leads me to conclude that your condition is trying to find the scenario of where they DO match.  I would then assume your other conditions are for when they DON'T match.

A good way to test your condition logic is to create a Filter using the same technique and see what machines you get.  I have my machine names set to sync the OS name with the DS console name so I'm not in a position to re-create your scenario.

In any case this job is not going to revent the user from renaming thier machine, it will only execute jobs when the condition is found.  I would look more at reducing the users rights in AD and the local workstation to prevent this behavior.

After all the talking stops 1 simple fact remains.

It is what we, collectively, have allowed it to become.

spazzzen's picture
26
Aug
2009
0 Votes 0
Login to vote

Needed in the DS

I need this in the DS so that when we run a job that corrects the name it will not mess things up.  Here is what our current Rename job does:

For each site we have a modify configuration job that adds the computer to the correct OU in AD but to do this, since the computer is already in AD we have to remove/delete the computer from the domain and then re-add it to the domain with the new name.  The new name is bassed on the name in the DS, so all our names should eventually match the computer names.  Ever once in a while I temporarly enable the name sycn that you use for the times when a user manually changes their computer name (end users can't do this).  So the problem would come when someone tries to run this job when the computer name is the same as it is in the DS.  The computer would be deleted from the domain and then re-added, but because we have multiple sites it would end up deleting itself again once the domain structure is replicated out.  So to fix this problem I need to make it not delete it from the domain when the name is the same hence the conditions above, but they do not work.  I did a sync of the computer name with the DS name and tried running the job and it still only runs the default condition and not the previously made condtions. 

So if the above conditions don't work, is there another condition I can use that will work where I can test the computer name against the DS name?

Don Rowland's picture
26
Aug
2009
0 Votes 0
Login to vote

Use your tools

OK, but have you tried the DS Filter to see if your condition logic is returning what you expect it to be?

I think i understand what you are doing.  I don't think I'd go about it the same way. I have 47 sites (and growing through acquisition) and our naming convention is unique to each and we have multiple domains.  I am constantly renaming machines and joining them to various domains.

I approached my scenario by using VBscripts in my Jobs and using the first 3 octets of the IP address for my conditions.  The conditions allow me to execute the jobs that are appropriate to that site and the VBscripts allow me to be very dynamic in evaluating what activities need to be performed.  One step that is a huge help is my VBscripts make DB calls back to my DS database so I can see what DS knows about the machine the scripts are running on.

After all the talking stops 1 simple fact remains.

It is what we, collectively, have allowed it to become.

spazzzen's picture
26
Aug
2009
0 Votes 0
Login to vote

Filter does not work

Ok, so obviously the filter does not work, which I guessed since the conditions did not work so I need another way to do it.  We only build the computers at a few specific sites and then either give them to the user to take back or take them back are selves so I can't use the ip address.  We have 11 sites right now that we use in the Deployment console, and a condition for each site so it adds it to the correct OU on a single domain, which to me would be easier then writing it all in a program code.   That and I don't know VBscript. 

So, seeing that tokens can't be used as a condition how can I make sure the Computer Name and DS Name are not the same when the computer is deleted from the domain?

Don Rowland's picture
26
Aug
2009
0 Votes 0
Login to vote

Other DS attributes

Well there are other computer attributes that DS stores that will tell you if it is joined to a domain and what OU it is in.

The network section of the DS computer object properties provides that data.  I don't have the token names off the top of my head.  You can use the 'workgroup/domain name' value in the Filters.

If you want to look at scripts we came converse through other meand and I will share some scripts with you.

After all the talking stops 1 simple fact remains.

It is what we, collectively, have allowed it to become.