
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 02:40 PM
Hello!
I've been tasked with changing the computer description on our Windows servers. (In system settings)
We do have a description current that gets fed into LanSweeper.
The task is to prepend either a TEST or PROD at the beginning of each description on each server.
Can this be done with LanSweeper?
I did attempt to change the computer description on one computer in LS by editing the asset and changing the description field, but it does not appear to change anything on the actual server.
Thank you!
I've been tasked with changing the computer description on our Windows servers. (In system settings)
We do have a description current that gets fed into LanSweeper.
The task is to prepend either a TEST or PROD at the beginning of each description on each server.
Can this be done with LanSweeper?
I did attempt to change the computer description on one computer in LS by editing the asset and changing the description field, but it does not appear to change anything on the actual server.
Thank you!
Labels:
- Labels:
-
General Discussion
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 09:28 PM
Create the following asset action:
Here is the changeAdCompDesc.vbs - be sure to replace "dc=your-domain,dc=com" with your own DC
cscript {actionpath}changeAdCompDesc.vbs {computer}
Here is the changeAdCompDesc.vbs - be sure to replace "dc=your-domain,dc=com" with your own DC
' 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=your-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

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2022 10:22 PM
Could you not deploy a package like below.
net config server /srvcomment:"%COMPUTERNAME%"
We currently don't update the computer description but we label the C drive with the computer name using the following.
LABEL C:%COMPUTERNAME%
We also have a script which writes the computer info into AD.
net config server /srvcomment:"%COMPUTERNAME%"
We currently don't update the computer description but we label the C drive with the computer name using the following.
LABEL C:%COMPUTERNAME%
We also have a script which writes the computer info into AD.
' This script changes a computer's description as well as registers it in active directory with the serial number and last logged in user.
' If you want this to update automatically, make this a logon script in group policy.
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colsystemenclosure = objwmiservice.execquery("Select * from Win32_SystemEnclosure")
' Get Serial number
For Each objcomputer In colsystemenclosure
serialnumber = Trim(objcomputer.serialnumber)
Next
'get AD user
Set adsinfo = CreateObject("adsysteminfo")
Set adcomputer = GetObject("LDAP://" & adsinfo.ComputerName)
Set aduser = GetObject("LDAP://" & adsinfo.UserName)
username = aduser.cn
strcomputer = wshnetwork.computername
Set objwmiservice = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2")
Set colcomputer = objwmiservice.execquery("Select * from Win32_computersystem")
Set colcomputerdisk = objwmiservice.execquery("Select * from Win32_diskdrive")
Set coloperatingsystem = objwmiservice.execquery("Select * from Win32_OperatingSystem")
Set colsystemenclosure = objwmiservice.execquery("Select * from Win32_SystemEnclosure")
Set colmacid = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Local Area Connection'")
'get model
For Each objcomputer In colcomputer
cpumanufacturer = objcomputer.manufacturer
cpumodel = Trim(objcomputer.model)
Next
' Get OS version
For Each objcomputer In coloperatingsystem
servicepack = objcomputer.servicepackmajorversion
osver = objcomputer.name
osver1 = Mid( osver, 18,3)
Next
'Pull the machine description. This can be formatted however you want. We use a "RM:" then a five letter description filled in with leading zeros.
desc = GetDesc()
'sets the information in AD
'adcomputer.put "description", "LU: " & username & ", PC: " & desc & ", OS: " & osver1 & ", Mod: " & cpumodel & ", SN: " & ucase(serialnumber)
'adcomputer.put "description", "LU: " & username & ", OS: " & osver1 & ", Mod: " & cpumodel & ", SN: " & ucase(serialnumber)
adcomputer.put "description", "" & username & ", OS: " & osver1 & ", Mod: " & cpumodel & ", SN: " & ucase(serialnumber)
adcomputer.Setinfo
'This bit sets the last logged on user as the "phonetic display name" in AD. It makes it easy to figure out what computer someone is talking about just by adding a column.
'adcomputer.put "msDS-PhoneticDisplayName", "Last User: " & username
'adcomputer.setinfo
Function GetDesc()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT Description FROM Win32_OperatingSystem")
For Each objItem in colItems
desc = objItem.Description
Next
GetDesc = desc
End Function
Function GetUser()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
user = objComputer.UserName
Next
GetUser = user
End Function

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 12:56 PM
Hi,
you can add an asset action like this: "cmd.exe /c {actionpath}comp_desc.vbs {smartname}"
This will start the following script in the defined directory (actionpath) and ask for a computer description:
"
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = Wscript.Arguments.Item(0)
strDescription = Inputbox("Geben Sie die Beschreibung des PC's ein:")
Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem")
For Each x In Obj
x.Description = strDescription
x.Put_
Next
WScript.Quit
"
you can add an asset action like this: "cmd.exe /c {actionpath}comp_desc.vbs {smartname}"
This will start the following script in the defined directory (actionpath) and ask for a computer description:
"
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = Wscript.Arguments.Item(0)
strDescription = Inputbox("Geben Sie die Beschreibung des PC's ein:")
Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem")
For Each x In Obj
x.Description = strDescription
x.Put_
Next
WScript.Quit
"
