Skip to content

OSD VBS issue

Featured Replies

Hi all,

I hope you can help me with a small problem I am having trying to get a vbs to run to update a computer extensionattribute in AD during OSD.

I have created 2 variables on the collection that the TS runs against. These are: OSDComputerName and OSDTechnician.

OSDComputerNameis simply to name the machine when launching the TS, and OSDTechnician to, hopefully, populate the computer AD account extensionattribute1 with that value.

 

The script I am using works fine in windows, it works fine if I run the script during the TS, by pressing F8 and running the following:

runas /user:uk\useraccount /netonly cmd.exe
Then in the new window, under these credentials running the script works fine. (The account I actually use is a Domain Admin account).

However, if I simply just let the TS run, the script runs but AD never gets updated. (The script is set in the TS to use this domain admin account on a run command line task). Also, this step is after the config manager client install.

 

SMSTS shows this:

Active Directory: The attribute syntax specified to the directory service is invalid.

Which leads me to believe that it is passing a blank value OR the account\script cannot read the TS variable to pass to the vbs variable.

 

The script I am using is here:

set env = CreateObject("Microsoft.SMS.TSEnvironment")

OSDTech = env("OSDTechnician")
OSDCompName = env("OSDComputerName")

ExtAttr = "ExtensionAttribute1"

Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

objComputer.Put ExtAttr, OSDTech
objComputer.SetInfo

 

 

If anyone can help with this, or if anyone has a script that does the same thing that they know works, it would be appreciated.

 

Thanks =)

To troubleshoot this, you could try hard coding a value and seeing if the script updates AD with that information when run in the TS, that removes the TS variable being interpreted correctly from the equation.

 

Inversely, you could add another command which interprets the TS variable and does something else, like just create a local text file to confirm it has run, that would avoid AD from the equation.

  • Author

Hi,

Thanks for the feedback, I have run it with a hardcoded value and it does update AD.

So the variable is not working, but does work with a runas.

The commandline is using a domain admin account to run too.

 

Any ideas?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.