Howto add Windows and Linux client in OCS-Inventory NG

Watch the video on how to add Ubuntu Server 14.04 LTS

thanks for watching :smile:

4 Likes

Watch the video on how to add Windows 8.1

thanks for watching :smile:

4 Likes

soon i will add the OCS-Inventory NG Server to himself :smile:

stay tuned!

Wow @ironsky! Great job, guy! Very appreciated! :+1::+1::+1::+1:

1 Like

It is also interesting the installation of the plugin MSofficekey

That has to be installed on the server and station. It is simple but of great help to manage office licenses.

I have the version 2.0.5 of OCS Server (Ubuntu 12)

Not yet tested it with the version used in Nethserver

http://wiki.ocsinventory-ng.org/index.php/Plugins:MSofficeKey2.1

@alexcsilva this is a good plugin and can you share the script you use for older version of OCS? Let me check if we can use it to the version what we have on NS.

Keep coming mate :smile:

I’m using OCS server and OCS agent the same version 2.0.5


'' Plugin for OCS Inventory NG 2.x '' officekey 2.1.0 (01/02/2012) '' Nicolas DEROUET (nicolas.derouet[gmail]com) On Error Resume Next
 
Const HKEY_LOCAL_MACHINE = &H80000002
 
Dim aOffID(3,1)
aOffID(0,0) = "XP"
aOffID(0,1) = "10.0"
aOffID(1,0) = "2003"
aOffID(1,1) = "11.0"
aOffID(2,0) = "2007"
aOffID(2,1) = "12.0"
aOffID(3,0) = "2010"
aOffID(3,1) = "14.0"
 
Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
oCtx.Add "__ProviderArchitecture", 64
 
Set oLocator = CreateObject("Wbemscripting.SWbemLocator")
Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")
 
osType = 32
oReg.GetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE", osProc
If osProc = "x86" Then osType = 32
If osProc = "AMD64" Then osType = 64
 
For a = LBound(aOffID, 1) To UBound(aOffID, 1)
  searchKey "SOFTWARE\Microsoft\Office\" & aOffID(a,1) & "\Registration", true
  searchKey "SOFTWARE\Wow6432Node\Microsoft\Office\" & aOffID(a,1) & "\Registration", false
Next
 
Sub searchKey(regKey, likeOS)
  oReg.GetBinaryValue HKEY_LOCAL_MACHINE, regKey, "DigitalProductID", aDPIDBytes
  If IsNull(aDPIDBytes) Then
    oReg.EnumKey HKEY_LOCAL_MACHINE, regKey, aGUIDKeys
    If Not IsNull(aGUIDKeys) Then
      For Each GUIDKey In aGUIDKeys
        searchKey regKey & "\" & GUIDKey, likeOS
      Next
    End If
  Else
    oKey = decodeKey(aDPIDBytes, (a>2))
    oReg.GetStringValue HKEY_LOCAL_MACHINE, regKey, "ConvertToEdition", oEdit
    If IsNull (oEdit) Then oEdit = "Microsoft Office " & aOffID(a,0)
    oReg.GetStringValue HKEY_LOCAL_MACHINE, regKey, "ProductName", oProd
    If IsNull (oProd) And (aOffID(a,0) = "2003") And _
       (oKey = "MF4QD-3T4PM-26X66-4KH7R-QGTYT") Then oProd = "Microsoft Office Visio Viewer 2003"
    oReg.GetStringValue HKEY_LOCAL_MACHINE, regKey, "ProductID", oProdID
    oBit = osType
    If Not likeOS Then oBit = 32
    oNote = ""
    writeXML oEdit,oProd,oProdID,oBit,oKey,oNote
  End If
End Sub
 
Sub writeXML(oEdit,oProd,oProdID,oBit,oKey,oNote)
  Wscript.Echo _
  "<OFFICEPACK>" & vbNewLine & _
  "<OFFICEVERSION>" & oEdit & "</OFFICEVERSION>" & vbNewLine & _
  "<PRODUCT>" & oProd & "</PRODUCT>" & vbNewLine & _
  "<PRODUCTID>" & oProdID & "</PRODUCTID>" & vbNewLine & _
  "<TYPE>" & oBit & "</TYPE>" & vbNewLine & _
  "<OFFICEKEY>" & oKey & "</OFFICEKEY>" & vbNewLine & _
  "<NOTE>" & oNote & "</NOTE>" & vbNewLine & _
  "</OFFICEPACK>"
End Sub
 
Function decodeKey(iValues, newOffice)
  Dim arrDPID, foundKeys
  arrDPID = Array()
  foundKeys = Array()
 
  If (newOffice) Then
    ' 2010     For i = 808 to 822
      ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
      arrDPID( UBound(arrDPID) ) = iValues(i)
    Next
  Else
    ' 2007, 2003 and XP     For i = 52 to 66
      ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
      arrDPID( UBound(arrDPID) ) = iValues(i)
    Next
  End If
 
  Dim arrChars
  arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
 
  For i = 24 To 0 Step -1
    k = 0
    For j = 14 To 0 Step -1
      k = k * 256 Xor arrDPID(j)
      arrDPID(j) = Int(k / 24)
      k = k Mod 24
    Next
    strProductKey = arrChars(k) & strProductKey
    If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
  Next
 
  ReDim Preserve foundKeys( UBound(foundKeys) + 1 )
  foundKeys( UBound(foundKeys) ) = strProductKey
  strKey = UBound(foundKeys)
 
  decodeKey = foundKeys(strKey)
End Function
Check the result
Result is inserted in XML file generated by agent. If you want to store this file in local, launch your agent with option /XML="C:\Documents and Settings\All Users\Application Data\OCS Inventory NG\Agent".
<OFFICEPACK>
            <OFFICEVERSION>Microsoft Office XP</OFFICEVERSION>
            <PRODUCT />
            <PRODUCTID>55555-666-0844444-11111</PRODUCTID>
            <TYPE>32</TYPE>
            <OFFICEKEY>BBBBB-DDDDD-88888-KKKKK-66666</OFFICEKEY>
            <NOTE />
</OFFICEPACK>
Database server
Create table in database to store informations
You have to create a new table which will receive new data   [JD:  Once viewing the ocsweb database in PhpMyAdmin, I copied the following statement and pasted it into a MySQL query box.  Worked wonderfully.]
CREATE TABLE IF NOT EXISTS `officepack` (
  `ID` INT(11) NOT NULL AUTO_INCREMENT,
  `HARDWARE_ID` INT(11) NOT NULL,
  `OFFICEKEY` VARCHAR(255) DEFAULT NULL,
  `OFFICEVERSION` VARCHAR(255) DEFAULT NULL,
  `PRODUCT` VARCHAR(255) DEFAULT NULL,
  `PRODUCTID` VARCHAR(255) DEFAULT NULL,
  `TYPE` INT(11) DEFAULT NULL,
  `NOTE` VARCHAR(255) DEFAULT NULL,
  PRIMARY KEY  (`ID`,`HARDWARE_ID`)
) ENGINE=INNODB ;
Management server
Modifiy the engine
You have to modify Map.pm ( in /usr/local/share/perl/5.10.0/Apache/Ocsinventory/ )  [JD: It's really unclear what you do with this code with these instructions.    Turns out you Insert in the line immediately after the last comma of the document and before the closing ");" and "1;".]
#Plugin MS OFFICE PACK
 officepack => {
  mask => 0,
  multi => 1,
  auto => 1,
  delOnReplace => 1,
  sortBy => 'OFFICEVERSION',
  writeDiff => 0,
  cache => 0,
  fields => {
   OFFICEKEY => {},
   OFFICEVERSION => {},
   PRODUCT => {},
   PRODUCTID => {},
   TYPE => {},
   NOTE => {},
 }
},

Hey bro, can you send the file instead? i’ll PM my email… :smiley:

Watch this video on how to add CentOS 6.x my NethServer 6.7 to himself.

thanks for watching

2 Likes

No audio at all?

Yes, I am on duty when doing that videos and my background is too noisy.

2 Likes

How is it going with your Nagios and OCS installation?
Everything ok?

@alefattorini - everything smooth… and very stable… affter i installed nethserver with nagios and ocs… i didnt touch it again until now… :smile:

1 Like

Sounds good! So you’re our nagios/ocs expert here :slight_smile:
Can you port your video on http://wiki.nethserver.org too? Our @docs_team will be happy

no problem mate and not an expert :slight_smile: still learning like you guys :slight_smile:
i’ll let you know once done.

cheers!

1 Like

Hi

To following up the Video but it is not work …client don’t send data to server, where is location the cacert.pem?
I use Nethserver 6.8 and Windows 7 connect via https