![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 | |
Jack Burton
![]() Join Date: August 24, 2002
Location: Aussie now in the US of A!
Age: 38
Posts: 5,403
|
Rightio people's, I have a problem.
My scripting knowledge is very limited (And I intend to keep it that way) however I need to add to a script at work to fix a problem we have. Long story short, we use Microsoft SMS to roll out our SOE images and once the OS has been built, we run a script which does all the configuration. A little while ago we found that some computers were being built and added to the domain with the name “Telstra” and a random number sequence instead of “NML” followed by the Dell service tag, after some problem analysis we found that a certain part of the script (The part that renames the machine and rejoins the domain, was failing if the computer already exists in AD, seeing as how netdom cannot remove objects from AD I need to add something to the script before that step which searches AD for the machine and deletes it if something is found. So basically, my script can find the Dell Service tag (called “sAssetTag” in the script) and I can search through AD and delete an object based on the location details that are found by the search, however I can’t figure out how to tell the search to find a computer object with the name ‘sAssetTag’, if I specifically state what the name is I am looking for, such as “8DFGN1S” the whole thing works, but I want the search to find a computer in AD based on the result of “sAssetTag”. Effectively making it a one script fits all sort of thing. Hope that explains it…. Anyways, below is the script I am using: I’m sure it’s not the perfect script, and I can probably take some things out and shorten it, however it (sort of) works and I don’t know enough about scripting to make it more efficient! Quote:
I removed the Domain name intentionally… And don’t worry about the “cool” and “not cool” parts [img]tongue.gif[/img] That’s just to tell me what part it’s getting to! Any help would be great! [ 06-26-2007, 03:33 AM: Message edited by: Hivetyrant ] |
|
![]() |
![]() |
![]() |
#2 | |
Jack Burton
![]() Join Date: July 19, 2003
Location: an expat living in France
Age: 40
Posts: 5,577
|
Since you're on the inside of a string (objCommand.CommandText takes a string) you need to concatenate the computer name inside it, so something like:
Quote:
__________________
|
|
![]() |
![]() |
![]() |
#3 | |
Jack Burton
![]() Join Date: August 24, 2002
Location: Aussie now in the US of A!
Age: 38
Posts: 5,403
|
Yeah, that was one of the first things I tried, but the script fails on line 32:
Quote:
![]() Appreciate the help though [img]smile.gif[/img] |
|
![]() |
![]() |
![]() |
#4 |
Jack Burton
![]() Join Date: August 24, 2002
Location: Aussie now in the US of A!
Age: 38
Posts: 5,403
|
Phew, problem solved....
It was actually quite simple [img]tongue.gif[/img] Dplax, you pretty much had it, but I needed to put single quotes outside the double quotes [img]smile.gif[/img] Thanks for your help! |
![]() |
![]() |
![]() |
#5 |
Jack Burton
![]() Join Date: July 19, 2003
Location: an expat living in France
Age: 40
Posts: 5,577
|
You're welcome!
__________________
|
![]() |
![]() |
![]() |
#6 |
Dracolisk
![]() Join Date: November 1, 2002
Location: Australia ..... G\'day!
Posts: 6,123
|
Mate you should be more worried about this VB script problem Hives [img]graemlins/cheers.gif[/img]
The alcohol content of Victoria Bitter beer is to be reduced by 0.1 percent as part of brewer Foster's plan to save millions of dollars. Foster's is also set to increase the wholesale price of all its packaged beers — including VB, Carlton, Crown Lager and Pure Blonde — by two percent next month. The VB alcohol content will drop from 4.9 percent to 4.8 percent, which according to experts is enough to save Foster's $20 million in annual beer tax. Story ninemsn Wednesday July 4
__________________
![]() fossils - natures way of laughing at creationists for over 3 billion years |
![]() |
![]() |
![]() |
#7 |
Bastet - Egyptian Cat Goddess
![]() Join Date: September 5, 2001
Location: Calgary, AB
Age: 50
Posts: 3,491
|
quotes are so annoying.
[ 07-04-2007, 12:11 PM: Message edited by: pritchke ] |
![]() |
![]() |
![]() |
#8 | |
Jack Burton
![]() Join Date: August 24, 2002
Location: Aussie now in the US of A!
Age: 38
Posts: 5,403
|
Quote:
![]() Good thing I don't drink VB or Carlton! (XXXX Gold man here ![]() |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
URGENT HELP | jamalez | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 7 | 03-16-2003 09:02 AM |
Please help me! its urgent! | GREENK | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 3 | 09-25-2002 08:49 AM |
In Urgent Need of Help =( | Estasios | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 15 | 05-09-2002 01:00 PM |
Urgent...Sig Help Please | onthepequod | General Conversation Archives (11/2000 - 01/2005) | 13 | 04-07-2002 02:31 PM |
Urgent help !!! please help me | ball | Darkstone | 1 | 04-12-2000 03:41 PM |