
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014
02:42 PM
- last edited on
‎07-04-2023
05:35 PM
by
ErikT
This package changes the computer description to (Model: SerialNumber or to the provided parameter name ex: CmpDesc.vbs "description_here") using the script "CmpDesc.vbs".
You can edit the description in the vbs file.
- Labels:
-
Share(d) Packages

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2015 07:30 PM
I actually was looking for chaging the AD computer object description.
For instance to populate it with the AD User Display Name.
This mightt be a bit more complicated.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 08:57 PM
jacobsenm wrote:
Thanks both.
I actually was looking for chaging the AD computer object description.
For instance to populate it with the AD User Display Name.
This mightt be a bit more complicated.
Thanks
Easy enough to do with an Action. Save the following to a file. I called mine adcompdesc.vbs
' Get computer object in AD
strComputer = WScript.Arguments(0)
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://dc=domain,dc=com' WHERE objectCategory='computer' and name = '" & strComputer & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
Set objComputer = GetObject("LDAP://" & strDN)
' Input new AD computer description field
newDescription = InputBox("Please enter the new AD Computer Description: ", "New description")
If newDescription = "" Then
Wscript.Echo ("Invalid description and this script will quit.")
Wscript.Quit
End If
' Write to AD computer object
objComputer.Put "Description" , newDescription
objComputer.SetInfo
And as for the action itself, create an action with the following line:
runas.exe /user:DOMAIN\ADMINRIGHTSUSER "cscript {actionpath}adcompdesc.vbs {computer}"
The script requires you to have admin rights to Active Directory, and works like a champ.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2017 05:21 AM
Charles wrote:jacobsenm wrote:
Thanks both.
I actually was looking for chaging the AD computer object description.
For instance to populate it with the AD User Display Name.
This mightt be a bit more complicated.
Thanks
Easy enough to do with an Action. Save the following to a file. I called mine adcompdesc.vbs
' Get computer object in AD
strComputer = WScript.Arguments(0)
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://dc=domain,dc=com' WHERE objectCategory='computer' and name = '" & strComputer & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
Set objComputer = GetObject("LDAP://" & strDN)
' Input new AD computer description field
newDescription = InputBox("Please enter the new AD Computer Description: ", "New description")
If newDescription = "" Then
Wscript.Echo ("Invalid description and this script will quit.")
Wscript.Quit
End If
' Write to AD computer object
objComputer.Put "Description" , newDescription
objComputer.SetInfo
And as for the action itself, create an action with the following line:
runas.exe /user:DOMAIN\ADMINRIGHTSUSER "cscript {actionpath}adcompdesc.vbs {computer}"
The script requires you to have admin rights to Active Directory, and works like a champ.
Hello!
When I run this script I get an error:
String: 2
Symbol: 1
vbscript index out of range
800A0009
Tell me please what is the problem?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2015 06:24 PM
Dim reg, objRegistry
Dim SN, M, ValueName, strComputer
Const HKLM = &H80000002
strComputer = "."
Set reg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
on error resume next
If WScript.Arguments.count = 0 Then
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2").ExecQuery("Select * FROM Win32_OperatingSystem")
For Each object In objRegistry
SN = object.SerialNumber
Next
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2").ExecQuery("Select * FROM Win32_ComputerSystem")
For Each object In objRegistry
M = object.Model
Next
value = M & ": " & SN
key = "SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters"
ValueName = "srvcomment"
If Len(value) > 48 Then value = Left(value, 48)
reg.SetStringValue HKLM, key, ValueName, value
Else
value = WScript.Arguments(0)
key = "SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters"
ValueName = "srvcomment"
reg.SetStringValue HKLM, key, ValueName, value
End if
I don't know crap about code to know if it's substantially different other than being more lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2015 06:31 PM
the one I posted is for ACTION, the other one might be for deployment ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2015 05:15 PM
strComputer = Wscript.Arguments.Item(0)
strDescription = Inputbox("Enter Description:")
Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem")
For Each x In Obj
x.Description = strDescription
x.Put_
Next
WScript.Quit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2015 11:52 AM
Where is the "CmpDesc.vbs" script ?
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2015 06:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2015 11:16 AM
