Thursday, May 24, 2012

To Increase SMS Client CacheSize


On Error Resume Next

Dim oUIResManager
Dim oCache
Dim CacheSize

CacheSize=3086

Set oUIResManager = createobject("UIResource.UIResourceMgr")

If oUIResManager Is Nothing Then
    wscript.echo "Could not create Resource Manager - quitting"
    wscript.quit
End If

Set oCache=oUIResManager.GetCacheInfo()

If oCache Is Nothing Then
    Set oUIResManager=Nothing
    wscript.echo "Could not get cache info - quitting"
    wscript.quit
End If

oCache.TotalSize=CacheSize

To uninstall using product code - Any app


To uninstall using product code (you can uninstall multiple apps at one go) - use product cod​e.txt and make sure that product code in the text file


-------------------------------------

On error resume next



Dim WSHShell, objFSO, strParentFldr, strProdFile,objTemp,strLine , strRegKey, strSubKey, strUninstallString, exitcode

Set WSHShell = CreateObject("WScript.Shell")

Set objFSO =CreateObject("Scripting.FileSystemObject")

strParentFldr = objFSO.GetParentFolderName(wscript.ScriptFullName)

strProdFile = strParentFldr &"\ProductCode.txt"

Set objTemp = objFSO.OpenTextFile (strProdFile, 1, True)



strSubKey = ""



Do while Not objTemp.AtEndOfStream

                strLine = objTemp.ReadLine

                strRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"& strLine & "\"

                strSubKey = WSHShell.RegRead (strRegkey& "DisplayName")

                if strSubKey <> "" Then

                                strUninstallString ="msiexec /x" & " " & strLine & " /qn"

                                exitcode =WSHShell.Run(strUninstallString, 1, True)

                End IF

                strSubKey = ""

Loop

Wscript.quit (exitcode)


Troubleshooting Management Point Communication


Do you know/why the MP list and MP cert commands : Troubleshooting Management Point Communication

SCCM: How to Exclude Files From Software Inventory



How to Exclude Files From Software Inventory


You can create a hidden file named Skpswi.dat and place it in the root of a client hard drive to exclude it from software inventory. You can also place this file in the root of any folder structure you want to exclude from software inventory. This procedure can be used to disable software inventory on a single workstation or server client, such as a large file server.
The Skpswi.dat file only prevents software inventory for computer clients and does not affect mobile device client inventory.

Software inventory will not inventory the client drive again unless this file is deleted from the drive on the client computer.
To exclude files from software inventory
  1. Using Notepad.exe, create an empty file named SkpSwi.dat.
  2. Right click the SkpSwi.dat file and click properties. In the file properties for the SkpSwi.dat file, select the Hidden attribute.
  3. Place the SkpSwi.dat file at the root of each client hard drive that you do not want to collect software inventory from.

Monday, March 26, 2012

Tip: how can I target applications to specific hardware (just a tip ignore if you know this pls)

Tip: how can I target applications to specific hardware (just a tip ignore if you know this pls)





also you can use below query if you want to create a collection based on hardware:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model in ("Latitude D420","Latitude D630","Latitude D430","Latitude D620")



Note: you can change hardware models based on your requirement in the query.

To increase log file size on SMS/SCCM client: ConfigMgr : Verbose and Debug Logging

To increase log file size:  ConfigMgr : Verbose and Debug Logging

64 Bit machine:
============
1.       In registry, go to HKLM > Software > WOW6432Node > Microsoft > CCM > Logging > @Global
2.       Right click on @Global and click on Permissions. Grant Administrators group with Full control.
3.       Modify the key: “LogLevel” and set the value from 1 to 0 –{This enables Verbose logging}
4.       Now, right click on Logging and create a new key and name it: DebugLogging
5.       Under DebugLogging, create a new string named: "Enabled" ->{Without Quotes}, and set the value to "True" ->{Without Quotes}. –{This enables Debug Logging}

32 Bit machine:
===========
1.       In registry, go to HKLM > Software > Microsoft > CCM > Logging > @Global
2.       Right click on @Global and click on Permissions. Grant Administrators group with Full control.
3.       Modify the key: “LogLevel” and set the value from 1 to 0 –{This enables Verbose logging}
4.       Now, right click on Logging and create a new key and name it: DebugLogging
5.       Under DebugLogging, create a new string named: "Enabled" ->{Without Quotes}, and set the value to "True" ->{Without Quotes}. –{This enables Debug Logging}


Once done restart the SMS AGENT host Service and wait for 10

Thursday, August 11, 2011

IP script- you will gett IP if you provide hostname in the c:\script\computers.txt - SCCM

' PING-IP-to-Excel
' IP to Hostname --- or --- Hostname to IP

' Inspired by: Torgeir Bakken (MVP)  
' http://groups.google.com/group/microsoft.public.scripting.vbscript/msg/a465907f8dc6e265?pli=1
'
'
' HOSTNAME  IP  RESULT  LATENCY
' --------  --  ------  -------
'
' Using only PING at the command prompt
'
' Version 7.0 Jan/16/2011
'
Dim strHostname, strIP, strPingResult, IntLatency
intRow = 2
Set objExcel = CreateObject("Excel.Application")
With objExcel
   
    .Visible = True
    .Workbooks.Add
   
    .Cells(1, 1).Value = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
    .Cells(1, 2).Value = "XXXXXXXXXXXXXX"
    .Cells(1, 3).Value = "XXXXXXX"
    .Cells(1, 4).Value = "XXXXXXX"
   
    .Range("A1:D1").Select
    .Cells.EntireColumn.AutoFit
   
    .Cells(1, 1).Value = "Hostname"
    .Cells(1, 2).Value = "IP"
    .Cells(1, 3).Value = "Result"
    .Cells(1, 4).Value = "Latency"
   
End With
'--- Input Text File with either Hostames or IP's ---
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("c:\script\Computers.Txt")
Do While Not (InputFile.atEndOfStream)
   
    strHostname = InputFile.ReadLine
   
    Set WshShell = WScript.CreateObject("WScript.Shell")
   
    Call PINGlookup( strHostname, strIP, strPingResult, intLatency )
   
    With objExcel
        .Cells(intRow, 1).Value = strHostname
        .Cells(intRow, 2).Value = strIP
        .Cells(intRow, 3).Value = strPingResult
        .Cells(intRow, 4).Value = intLatency
    End With
   
    intRow = intRow + 1
   
Loop
With objExcel
    .Range("A1:D1").Select
    .Selection.Interior.ColorIndex = 19
    .Selection.Font.ColorIndex = 11
    .Selection.Font.Bold = True
    .Cells.EntireColumn.AutoFit
End With

'------------- Subrutines and Functions ----------------
Sub PINGlookup(ByRef strHostname, ByRef strIP, ByRef strPingResult, ByRef intLatency )
    ' Both IP address and DNS name is allowed
    ' Function will return the opposite
   
    ' Check if the Hostname is an IP
    Set oRE = New RegExp
    oRE.Pattern = "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
   
    ' Sort out if IP or Hostname
    strMachine = strHostname
    bIsIP = oRE.Test(strMachine)
    If bIsIP Then
        strIP = strMachine
        strHostname = "-------"
    Else
        strIP = "-------"
        strHostname = strMachine
    End If
   
   
    ' Get a temp filename and open it
    Set osShell = CreateObject("Wscript.Shell")
    Set oFS = CreateObject("Scripting.FileSystemObject")
    sTemp = osShell.ExpandEnvironmentStrings("%TEMP%")
    sTempFile = sTemp & "\" & oFS.GetTempName
   
    ' PING and check if the IP exists
    intT1 = Fix( Timer * 1000 )
    osShell.Run "%ComSpec% /c ping -a " & strMachine & " -n 1 > " & sTempFile, 0, True
    intT2 = Fix( Timer * 1000 )
    intLatency = Fix( intT2 - intT1 ) / 1000
   
   
    ' Open the temp Text File and Read out the Data
    Set oTF = oFS.OpenTextFile(sTempFile)
   
    ' Parse the temp text file
    strPingResult = "-------" 'assume failed unless...
    Do While Not oTF.AtEndoFStream
       
        strLine = Trim(oTF.Readline)
        If strLine = "" Then
            strFirstWord = ""
        Else
            arrStringLine = Split(strLine, " ", -1, 1)
            strFirstWord = arrStringLine(0)
        End If
       
        Select Case strFirstWord
           
            Case "Pinging"
                If arrStringLine(2) = "with" Then
                    strPingResult = "-------"
                    strHostname = "-------"
                Else
                    strHostname = arrStringLine(1)
                    strIP = arrStringLine(2)
                    strLen = Len( strIP ) - 2
                    strIP = Mid( strIP, 2, strLen )
                    strPingResult = "Ok"
                End If
                Exit Do           
            'End Case
           
            Case "Ping" ' pinging non existent hostname
                strPingResult = "------"
                Exit Do   
            'End Case
               
        End Select
       
    Loop
   
    'Close it
    oTF.Close
    'Delete It
    oFS.DeleteFile sTempFile
   
   
End Sub

SCCM to Tanium

SCCM transition Options: of course intune otherwise  Deployment, Patching - Tanium Image - Tazier Inventory - Tanium Remote Control - Zoom  ...