Hi all!
I hope you can help me!
I have a big task: create synchronization between ITSM and Active directory. More precisely I need actually information about PC in AD which should stored in ITSM as CI.
Question: how and with what toolkit a can create this?
Thanks a lot!
synchronization ITSM & AD
Moderator: crythias
-
- Znuny newbie
- Posts: 4
- Joined: 12 Jun 2013, 13:45
- Znuny Version: 3.2.6
- Real Name: Maksim
- Company: Ericsson Estonia
-
- Znuny newbie
- Posts: 49
- Joined: 28 Mar 2013, 13:02
- Znuny Version: 3.2.3
- Real Name: Kris ten Hoedt
- Company: Prominent
Re: synchronization ITSM & AD
Hi "StachelDraht"
,
I just created something like that. Let me tell you the steps I took.
1) Create a VBS script to gather data.
This VB script gathers computer info from WMI and writes it as a single string to the "ExtensionAttribute1" of the computer object in AD.
It looks like this:
Make it semicolon separated for easier conversion later on.
Include this VB script in the logon-script, and the computer data is updated everytime someone logs on.
2) Create a VB script to collect the "ExtensionAttribute1" for all the computer objects in AD. Or a selection, whichever suits your needs.
I scheduled this script to run once an hour, to keep de CMDB fresh. If you have a lot of PC's on your network, maybe run it less frequent.
This script writes a file which can be imported by OTRS. Create an import mapping in OTRS to do so.
3) Run the otrs.ImportExport.pl PERL script to import the file.
For me it also runs once an hour, but again, in larger environments this might be a bit over the top
So in the end it looks like this: If you need example scripts I can post them here if you like....

I just created something like that. Let me tell you the steps I took.
1) Create a VBS script to gather data.
This VB script gathers computer info from WMI and writes it as a single string to the "ExtensionAttribute1" of the computer object in AD.
It looks like this:
Code: Select all
WS90;kthoedt;Hewlett-Packard;HP Compaq 6000 Pro SFF PC;CZC1341Y0P;4096MB;VB0160EAVEQ;160GB;Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz;Intel(R) 82567LM-3 Gigabit-netwerkverbinding;10.1.35.251;Intel(R) Q45/Q43 Express Chipset (Microsoft Corporation - WDDM 1.1);Microsoft Windows 8 Pro;Microsoft Office Standard 2013;Desktop;Production;Operational
Include this VB script in the logon-script, and the computer data is updated everytime someone logs on.
2) Create a VB script to collect the "ExtensionAttribute1" for all the computer objects in AD. Or a selection, whichever suits your needs.
I scheduled this script to run once an hour, to keep de CMDB fresh. If you have a lot of PC's on your network, maybe run it less frequent.
This script writes a file which can be imported by OTRS. Create an import mapping in OTRS to do so.
3) Run the otrs.ImportExport.pl PERL script to import the file.
For me it also runs once an hour, but again, in larger environments this might be a bit over the top

So in the end it looks like this: If you need example scripts I can post them here if you like....
You do not have the required permissions to view the files attached to this post.
Version: OTRS 3.2.3 + ITSM
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
-
- Znuny newbie
- Posts: 4
- Joined: 12 Jun 2013, 13:45
- Znuny Version: 3.2.6
- Real Name: Maksim
- Company: Ericsson Estonia
Re: synchronization ITSM & AD
Hi Kris,
thank you very much for your answer. It`s a good solution for me!
Tell me please, if I want to create a file via php and ldap (for collecting data from AD) for import to ITSM , in what format should be data in this file.
And, where can I get any information about otrs.importexport.pl . Before your post I didn`t know anything this scripts!
P.S. my taks easier, I need store in ITSM only hostnames.
Thanks again, you really helped me!
thank you very much for your answer. It`s a good solution for me!
Tell me please, if I want to create a file via php and ldap (for collecting data from AD) for import to ITSM , in what format should be data in this file.
And, where can I get any information about otrs.importexport.pl . Before your post I didn`t know anything this scripts!
P.S. my taks easier, I need store in ITSM only hostnames.

Thanks again, you really helped me!
-
- Znuny newbie
- Posts: 49
- Joined: 28 Mar 2013, 13:02
- Znuny Version: 3.2.3
- Real Name: Kris ten Hoedt
- Company: Prominent
Re: synchronization ITSM & AD
OK, Part 1
Save the following code as 'update_ad.vbs' (or any other name, but keep the .vbs extension) and put it in your '\\<domain_controller>\NETLOGON' folder.
Then include the .vbs file in your logon script.
Then check in AD-U&C: computer->attribute editor->ExtensionAttribute1
After a successful run of the vbs script it should hold a string containing the computer data.
Please let me know how it goes....
Save the following code as 'update_ad.vbs' (or any other name, but keep the .vbs extension) and put it in your '\\<domain_controller>\NETLOGON' folder.
Then include the .vbs file in your logon script.
Then check in AD-U&C: computer->attribute editor->ExtensionAttribute1
After a successful run of the vbs script it should hold a string containing the computer data.
Please let me know how it goes....
Code: Select all
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo") 'Bind to AD
Set objNet = CreateObject("WScript.Network")
strCompDN = objSysInfo.ComputerName 'DN for computer
Set objComp = GetObject("LDAP://" & strCompDN) 'IADsComputer object
strUserDN = objSysInfo.UserName 'DN for user
Set objUser = GetObject("LDAP://" & strUserDN) 'IADsUser object
'RegExp object used to perform a simple match on IP address
Set objRE = New RegExp
objRE.IgnoreCase = True
objRE.Pattern = "^\d+\.\d+\.\d+\.\d+$"
'Connect to WMI
Set objWMI = GetObject("winmgmts:")
'Get logged on user
strUsrLogin = trim(LCase(objNet.UserName))
'Retreive network adapters and get the IP(s) assigned to whichever network adapter has our default gateway
Set colNICs = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
If colNICs.Count > 0 Then
For Each objNIC in colNICs
If IsArray(objNIC.DefaultIPGateway) Then
arrIP = objNIC.IPAddress
For i = 0 To UBound(arrip)
If objRE.Test(arrIP(i)) Then strIP = strIP & " " & arrIP(i)
Next
strMAC = trim(objNIC.MACAddress)
NicVendor = trim(objNic.Description)
strIP = trim(strIP)
End If
Next
End If
'Get brand, model and serial number
Set compDetails = objWMI.ExecQuery("select * from Win32_ComputerSystemProduct")
For Each Detail in compDetails
Brand = trim(Detail.Vendor)
Model = trim(Detail.Name)
SN = trim(Detail.IdentifyingNumber)
Next
'Get machine name
Set hwDetails = objWMI.ExecQuery("select * from Win32_ComputerSystem")
For Each hw in hwDetails
CompName = trim(hw.Caption)
Next
'Determine machine type
MachineType = "Desktop"
If lcase(left(CompName,2)) = "nb" then MachineType = "Laptop"
'Get CPU name
Set cpuDetails = objWMI.ExecQuery("Select * from Win32_Processor")
For Each detCPU in cpuDetails
CPUname = trim(detCPU.Name)
Next
'Get Videocard
Set vgaDetails = objWMI.ExecQuery("Select * from Win32_Videocontroller WHERE DeviceID = 'VideoController1'")
For Each detVGA in vgaDetails
VideoCard = trim(detVGA.Name)
Next
'Get Memory Size
Set colItems = objWMI.ExecQuery("SELECT * FROM Win32_PhysicalMemory WHERE DataWidth>2", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each item In colItems
Memory = Memory + CDbl(item.Capacity) / (1024^2)
Next
Memory = Memory & "MB"
'Get DISK0 type and size
Set diskDetails = objWMI.ExecQuery("Select * from Win32_DiskDrive WHERE DeviceID LIKE '%PHYSICALDRIVE0%'")
For Each disk in diskDetails
DiskSize = CInt(CDbl(disk.Size) / (1000^3)) & "GB"
DiskType = trim(disk.Caption)
Next
'Get Operating System
Set colOperatingSystems = objWMI.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
osVersion = trim(objOperatingSystem.Caption)
Next
'Get Office Version
OfficeVersion = "Microsoft Office not installed"
Set colSoftware = objWMI.ExecQuery("Select * FROM Win32_Product WHERE Caption LIKE '%Microsoft Office Standard%' OR Caption LIKE '%Microsoft Office Professional%'")
For Each objItem in colSoftware
OfficeVersion = trim(objItem.Name)
Next
'Create string to write to AD computer object
objComp.extensionAttribute1 = CompName & ";" & strUsrLogin & ";" & Brand & ";" & Model & ";" & SN & ";" & Memory & ";" & DiskType & ";" & DiskSize & ";" & CPUname & ";" & NicVendor & ";" & strIP & ";" & VideoCard & ";" & osVersion & ";" & OfficeVersion & ";" & MachineType & ";Production;Operational"
'Write to AD
objComp.SetInfo
Version: OTRS 3.2.3 + ITSM
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
-
- Znuny newbie
- Posts: 4
- Joined: 12 Jun 2013, 13:45
- Znuny Version: 3.2.6
- Real Name: Maksim
- Company: Ericsson Estonia
Re: synchronization ITSM & AD
Thank you!
My issue is solved!
My issue is solved!
-
- Znuny newbie
- Posts: 49
- Joined: 28 Mar 2013, 13:02
- Znuny Version: 3.2.3
- Real Name: Kris ten Hoedt
- Company: Prominent
Re: synchronization ITSM & AD
Wow.... and I never got to elaborate on step 2 & 3
Would you mind sharing how you did it?
Would you mind sharing how you did it?
Version: OTRS 3.2.3 + ITSM
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
OS: Win XP Pro SP3
DB: MySQL
Webserver: Apache
-
- Znuny newbie
- Posts: 4
- Joined: 12 Jun 2013, 13:45
- Znuny Version: 3.2.6
- Real Name: Maksim
- Company: Ericsson Estonia
Re: synchronization ITSM & AD
First of all, my task really simple.
I need to store only hostnames of PCs from one OU.
step 1: generating CSV file via PHP+LDAP (php easier for me, but this script not finished)
...
step 2: importng generated CSV file with otrs.ImportExport.pl from console - it will be cron task
That`s all
My problems were related to the lack of knowledge of the otrs.ImportExport.pl script
Thank you!
I need to store only hostnames of PCs from one OU.
step 1: generating CSV file via PHP+LDAP (php easier for me, but this script not finished)
Code: Select all
"Station name","Description","Production","Operational"
step 2: importng generated CSV file with otrs.ImportExport.pl from console - it will be cron task
That`s all

My problems were related to the lack of knowledge of the otrs.ImportExport.pl script
Thank you!