lunes, 19 de diciembre de 2011

Algunos reportes interesantes para SCCM

Hola!

Reportes!!! Seguramente tengan algunos reportes que utilicen bastante y que les sirven como base para crear otros reportes rápidamente.

Les dejo algunos bastantes interesantes
  • Información de espacio en disco de servidores:
SELECT SYS.Name,LDISK.DeviceID0, LDISK.Description0,
v_GS_COMPUTER_SYSTEM.Manufacturer0 as [Fabricante],
LDISK.VolumeName0 as [Nombre del disco],
LDISK.FreeSpace0 as [Espacio Libre (MB)],
LDISK.FreeSpace0/1024 as [Espacio Libre(GB)],
LDISK.Size0/1024 as [Total de espacio (GB)],
LDISK.FreeSpace0*100/LDISK.Size0 as C074

FROM v_FullCollectionMembership SYS
join v_GS_LOGICAL_DISK LDISK on SYS.ResourceID = LDISK.ResourceID
JOIN v_R_System RSYS ON SYS.ResourceID = RSYS.ResourceID
join v_GS_COMPUTER_SYSTEM on v_GS_COMPUTER_SYSTEM.ResourceID = RSYS.ResourceID

WHERE
LDISK.Size0 > 0
AND SYS.CollectionID = 'SMS000DS'
ORDER BY SYS.Name, LDISK.DeviceID0

  • Listar las colecciones a las que pertenece una máquina:
select  v_GS_COMPUTER_SYSTEM.Name0, v_Collection.Name,
v_FullCollectionMembership.CollectionID

from v_FullCollectionMembership inner join v_GS_COMPUTER_SYSTEM on v_FullCollectionMembership.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID join v_Collection on v_Collection.CollectionID = v_FullCollectionMembership.CollectionID
where v_GS_COMPUTER_SYSTEM.Name0 = @computer
  • Servidores con mas de 7 días sin reiniciarce:
SELECT     TOP (100) PERCENT dbo.v_R_System.Name0, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, DATEDIFF(Day,
                      dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, GETDATE()) AS [Días desde el ultimo reboot], dbo.v_GS_OPERATING_SYSTEM.Caption0
FROM         dbo.v_GS_OPERATING_SYSTEM INNER JOIN
                      dbo.v_R_System ON dbo.v_GS_OPERATING_SYSTEM.ResourceID = dbo.v_R_System.ResourceID
WHERE     (DATEDIFF(Day, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, GETDATE()) > 7)
ORDER BY [Días desde el ultimo reboot]


(cambiar el GETDATE()) > 7 por el numero de días que deseen)
  • Informa de las máquinas que no tienen un archivo y pertenece a una colección en particular
Este informe les servirá de base para reportes donde se tiene que saber que servidores NO tienen algo y cuales son los joins que se deben utilizar para preguntar por el nombre de una colección. NOTA: para que puedan hacer esta consulta deberán activar el inventario de software y configurar que se busque el archivo que deseamos.

Select distinct
 v_R_System.Netbios_Name0 as [Servidor sin ARCHIVO.TXT],
 v_R_System.Operating_System_Name_and0 as [Sistema Operativo]

FROM v_R_System
 inner join v_FullCollectionMembership ON v_FullCollectionMembership.ResourceID = v_R_System.ResourceID
 inner join v_Collection ON v_Collection.CollectionID = v_FullCollectionMembership.CollectionID
 WHERE
  v_R_System.Netbios_Name0 not in
   (

   select v_r_system.Netbios_Name0
    from
     v_GS_SoftwareFile inner join v_r_system on v_r_system.resourceid=v_GS_SoftwareFile.resourceid
    where
     v_GS_SoftwareFile.filename like 'ARCHIVO.TXT'
   )

AND
v_Collection.Name like 'Servidores que deben tener el Archivo.txt'

order by v_R_System.Netbios_Name0

No duden en consultarme por algún otro ejemplo u otro tema!

Gastón!

viernes, 16 de diciembre de 2011

Herramientas imprescindibles para administrar SCCM

Hola nuevamente.

En estas últimas entradas les acerqué varias herramientas de utilidad para cualquiera que administre una plataforma de SCCM.

En este les incluyo 2 herramientas excelentes, infaltables!

SMS Client Control Tool http://sourceforge.net/projects/smsclictr/
Ideal para contralar los agentes de SMS/SCCM, incluye funciones como forzar inventarios, controlar despliegues de aplicaciones, ver ventanas de mantenimiento, reparar el agente, resetear políticas de agente, etc etc...

SCCM Right Click Tools
http://myitforum.com/cs2/blogs/rhouchins/archive/2008/04/09/sccm-right-click-tools.aspx
Hace mas de un año que no se acutaliza pero contiene gran cantidad de funciones para administrar SCCM. Una vez instalada la aplicación se modifica las opciones que se tienen al utilizar el botón derecho del mouse agregando gran cantidad de acciones muy útiles.
Como esta aplicación modifica la consola de SCCM, recomiendo no instalarla en el servidor de SCCM.

A probarlas y comentarme que les han parecido!

Gaston!

jueves, 15 de diciembre de 2011

Modificar inventario en SCCM - sms_def.mof y configuration.mof

Hola!

Muchas veces nos hemos preguntado si estamos modificando correctamente los ficheros sms_def.mof y configuration.mof.
Ciertas veces hasta se nos olvida que una aplicacion puede ser también de 64 bits y no terminamos obteniendo los resultados que esperábamos.

Esta utilidad RegKeyToMOFv3.zip nos permite realizar automaticamente la modificación que necesitamos realizar en los ficheros sms_def.mof y configuration.mof.
http://dl.dropbox.com/u/45821515/RegKeyToMOFv3.zip


Con solo seleccionar la llave de registro de la cual deseamos obtener información, la aplicación generará la consulta que debemos agregar al final de los ficheros.
Como podrán ver pueden seleccionar la opción "Enable 64bits (for Regkeys not written in Wow6432Node)" para capturar también correctamente aplicaciones de 32 bits en Windows de 64bits

Espero que les sea de mucha utilidad.

Gastón Gardonio

miércoles, 7 de diciembre de 2011

Controlar agentes de SCCM - ClientHealthCollection

Hola!

Siempre estamos preguntandonos que equipos no reportan inventario hace una semana, cuales no tienen el agente funcionando correctamente, a cuales les falla el WMI, etc, etc..

Les acerco esta herramienta la cual crea una serie de colecciones jerarquizadas en SCCM para poder tomar acciones correctivas directamente.

Esta 100% probada y es la herramienta perfecta para utilizar con las RightClickTools

http://dl.dropbox.com/u/45821515/ClientHealthCollection.rar

Saludos!

Gaston Gardonio

jueves, 1 de diciembre de 2011

Forzar inventario de Hardware y Software

Hola!!

Bueno, post rapido. Recién tuve que forzar el inventario de varios equipos y me topé con estos scripts que tenia guardado.

Ejecutar con credenciales de administrador.

Script: Full software inventory scan

'Reset SMS Software Inventory Action to force a full HW Inventory Action
sInventoryActionID = "{00000000-0000-0000-0000-000000000002}"
' Get a connection to the "root\ccm\invagt" namespace (where the Inventory agent lives)
Dim oLocator
Set oLocator = CreateObject("WbemScripting.SWbemLocator")

Dim oServices
Set oServices = oLocator.ConnectServer( , "root\ccm\invagt")

' Delete the specified InventoryActionStatus instance
oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"

'Pause 3 seconds to allow the action to complete.
wscript.sleep 3000
'######################################
'Run a SMS Software Inventory
Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
Set actions = cpApplet.GetClientActions
For Each action In actions
If Instr(action.Name,"Hardware Inventory") > 0
Then action.PerformAction
End if
Next



Script: Full hardware inventory scan

'Reset SMS Hardware Inventory Action to force a full HW Inventory Action
sInventoryActionID = "{00000000-0000-0000-0000-000000000001}"

' Get a connection to the "root\ccm\invagt" namespace (where the Inventory agent lives)
Dim oLocator
Set oLocator = CreateObject("WbemScripting.SWbemLocator")

Dim oServices
Set oServices = oLocator.ConnectServer( , "root\ccm\invagt")

' Delete the specified InventoryActionStatus instance
oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"

'Pause 3 seconds to allow the action to complete. wscript.sleep 3000
'######################################
'Run a SMS Hardware Inventory
Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
Set actions = cpApplet.GetClientActions
For Each action In actions
If Instr(action.Name,"Hardware Inventory") > 0 Then
action.PerformAction
End if
Next


Saludos!

martes, 29 de noviembre de 2011

Obtener información de un archivo .ini con SCCM

Hola

En ciertas ocasiones nos solicitan obtener información de un archivo utilizando SCCM.
Al principio seguramente pensaríamos que podríamos utilizar "File Collection" podría ser la solución. Lamentablemente no es tan fácil, File Collection solo copia los archivos pero no podemos ver el contenido dinamicamente con SCCM. (No podríamos crear un reporte con el contenido del fichero)

Para ello es necesario enviar la información del fichero al WMI en cada equipo y modificar el smsdef.mof para obtener esta información con SCCM.

Debemos crear un paquete para que ejecute un VBS, este VBS enviará la información al WMI.

Si sabemos que solo unas máquinas tienen el fichero podemos publicarlo solo a esas máquinas (podríamos utilizar el software inventory para saber si la máquina tiene el fichero).
También podemos tener en cuenta cada cuanto se modifica el fichero para modificar el advertisiment y ejecutarlo cada cierto tiempo que creemos que se modifica el fichero.

Como hacerlo?

Crear un paquete que solo tenga el VBS que detalla abajo y publicar el advertisiment como cscript.exe WhateverYouCalledIt.vbs

Cambiar el TheIniFile= por el nombre del fichero INI del cual que queremos obtener información
En este ejemplo se obtiene el campo "Release" y "Description"

on error resume next'Lee el contenido del archivo .ini
'Vuelca el contenido a WMI
Set fso = CreateObject("Scripting.FileSystemObject")
TheIniFile = "c:\temp\someinifile.ini"


Dim wbemCimtypeString
wbemCimtypeString = 8


' Remueve la clases
Set oLocation = CreateObject("WbemScripting.SWbemLocator")
Set oServices = oLocation.ConnectServer(,"root\cimv2")
set oNewObject = oServices.Get("CM_INIBuildInfo")
oNewObject.Delete_
'=================
'Lee el archivo y obtiene la informacion
'=================
Dim str1(1)
Set objfile = fso.OpenTextFile(TheIniFile,1,False)
Do Until objFile.AtEndOfStream
strstring = objfile.ReadLine
If InStr(strstring,"=") > 0 then
   str2 = Split(strstring, "=", -1, 1)
   If lcase(str2(0)) = "release" Then
     str1(0) = str2(1)
   End If
   If LCase(str2(0)) = "description" Then
     str1(1) = str2(1)
   End If
End If
Loop
objfile.close


'==================
'Copia la informacion a un Namespace de WMI
'==================
' Se crea la estructura para copiarla a WMI
' Nota=no usar la palabra release, esta reservada internamente
Set oDataObject = oServices.Get
oDataObject.Path_.Class = "CM_INIBuildInfo"
oDataObject.Properties_.add "Rel" , wbemCimtypeString
oDataObject.Properties_("Rel").Qualifiers_.add "key" , True
oDataObject.Properties_.add "Description" , wbemCimtypeString
oDataObject.Put_


Set oNewObject = oServices.Get("CM_INIBuildInfo" ).SpawnInstance_
oNewObject.Rel = cstr(str1(0))
oNewObject.Description = str1(1)
oNewObject.Put_


wscript.quit


'================

Como les había comentado debemos modificar el fichero sms_def.mof file en inboxes\clifiles.src\hinv para que SCCM pueda obtener la información. Siempre pegarlo al final del contenido.

//============Info de fichero INI===========
//Pre-requisito: Ejecutar el programa que copia la informacion a WMI
//==================================
[ SMS_Report     (TRUE),
  SMS_Group_Name ("INIBuildInfo"),
  SMS_Class_ID   ("CUSTOM|INIBuildInfo|1.0") ]
class CM_INIBuildInfo : SMS_Class_Template
{
    [SMS_Report (TRUE), key ] string rel;
    [SMS_Report (TRUE)      ] string Description;
};

Espero que les sea de utilidad.

Saludos

Gastón Gardonio