Notification

Icon
Error

Change Computer Description

Posted: Tuesday, November 18, 2014 2:42:32 PM(UTC)
Michael.V

Michael.V

Member Original PosterPosts: 251
0
Like
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.
Script - Change Computer DescriptionDownload Package
DescriptionThis package changes the computer description to (Model: SerialNumber or to the provided parameter name ex: CmpDesc.vbs "description_here") using the script "CmpDesc.vbs".
Final ActionNothing
Max. Duration2 min(s), 0 hour(s)
RescanNo
Steps
1. Check For Script
TypeCondition
SuccessGo To Step 2
FailureStop (Failure)
Conditions
File {PackageShare}\Scripts cmpdesc.vbs Exists
2. Call Script
TypeScript
Return Codes 0,1641,3010
SuccessStop (Success)
FailureStop (Failure)
Command wscript.exe {PackageShare}\Scripts\CmpDesc.vbs
Reen87
#1Reen87 Member Posts: 8  
posted: 4/10/2015 3:31:51 PM(UTC)
Hello all.

This function is grate. and realy save us some time. now has it that we have a company policy, that it's the dell service tag that is the computername. so we whant too have the full name of the user in description.

Now I have changed the script to make a popup box on the computer I deply the script on. where the user is told to put in his name.
Users beeing users, this does not always happen.

is it posible to make this script get the users full name,(eks. in reg). so the user does not need to type it in thereself?

Hope I made myself clear. English is not my first language.

Susan.A
#2Susan.A Member Administration Posts: 1,536  
posted: 4/17/2015 10:16:05 AM(UTC)
You could pull the currently logged on user from the client machine itself or (if hosted in SQL Server) from the Lansweeper database. The latter should be fairly accurate if you deploy after scanning. We can't really provide assistance for building or modifying specific deployment packages though. You will need to do some research online to find the steps you need.
HammettMike
#3HammettMike Member Posts: 44  
posted: 9/24/2015 5:44:29 PM(UTC)
Where's the VBS to download?
jacobsenm
#4jacobsenm Member Posts: 63  
posted: 9/30/2015 10:52:06 AM(UTC)
I am interested too.
Where is the "CmpDesc.vbs" script ?

Thank you.

PeterG
#5PeterG Member Posts: 104  
posted: 10/1/2015 4:15:21 PM(UTC)
Set WshNetwork = WScript.CreateObject("WScript.Network")

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
HammettMike
#6HammettMike Member Posts: 44  
posted: 10/1/2015 5:24:57 PM(UTC)
Oddly enough, I just found this already on the server:

Code:
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.
PeterG
#7PeterG Member Posts: 104  
posted: 10/1/2015 5:31:01 PM(UTC)
Mike,

the one I posted is for ACTION, the other one might be for deployment ..
jacobsenm
#8jacobsenm Member Posts: 63  
posted: 10/1/2015 6:30:58 PM(UTC)
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
Charles
#9Charles Member Posts: 1  
posted: 6/29/2017 7:57:46 PM(UTC)
Originally Posted by: jacobsenm Go to Quoted Post
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

Code:

' 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.
alar0n
#10alar0n Member Posts: 1  
posted: 6/30/2017 4:21:12 AM(UTC)
Originally Posted by: Charles Go to Quoted Post
Originally Posted by: jacobsenm Go to Quoted Post
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

Code:

' 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?

Active Discussions

Lansweeper Laptop warranty include users from active directory filtered by OU
by  Iyad   Go to last post Go to first unread
Last post: Yesterday at 11:09:27 PM(UTC)
Lansweeper Exclude Search
by  pryan67  
Go to last post Go to first unread
Last post: Yesterday at 4:01:43 PM(UTC)
Lansweeper Report: All Apple Mac devices with Memory RAM asset
by  gabrielo   Go to last post Go to first unread
Last post: Yesterday at 3:17:24 PM(UTC)
Lansweeper Does technical support for LS really respond?
by  tosch  
Go to last post Go to first unread
Last post: Yesterday at 12:48:50 PM(UTC)
Lansweeper Deployment packages using lsagent
by  CyberCitizen   Go to last post Go to first unread
Last post: 6/15/2021 11:44:33 PM(UTC)
Lansweeper INFO DateTimeService time refresh
by  ZachO21  
Go to last post Go to first unread
Last post: 6/15/2021 4:23:15 PM(UTC)
Lansweeper Helpdesk tabs always regenarated
by  Carla   Go to last post Go to first unread
Last post: 6/14/2021 9:49:27 PM(UTC)
Lansweeper Importing with user relations
by  teddyh2o  
Go to last post Go to first unread
Last post: 6/14/2021 6:05:46 PM(UTC)