Thursday, March 9, 2017

SCCM last logon username report



Query:

Add collection ID in 'X'

Select A.Name0, A.UserName0  from V_GS_COMPUTER_SYSTEM A join v_FullCollectionMembership B on A.ResourceID = B.ResourceID Where B.CollectionID ='X'


Output:

Machine name      username

SCCM Count of computer models report


Query:

Add collection ID in 'X'


SELECT CSYS.Model0, Count(*) as 'Count'

FROM v_GS_COMPUTER_SYSTEM CSYS

JOIN v_FullCollectionMembership fcm on CSYS.ResourceID=fcm.ResourceID

WHERE fcm.CollectionID='X'

GROUP BY CSYS.Model0

ORDER BY Count DESC

Output:

Model of computer       Count of machines



Cleanup CCMCache content older than 20 days



Create vbs file with the below codes and create a package in SCCM and run the deployment in a schedule cycle.

Modify X value in Const intDaysOld = "x" for days. eg: 30 equal to 30 days

Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv

Const intDaysOld = 20
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objFSO.FolderExists (windir & "\ccmcache") Then
Set objFolder = objFSO.GetFolder(windir & "\ccmcache")
For Each objSubFolder In objFolder.SubFolders
                If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
           objSubFolder.Delete True
    End If
Next
End if

Monday, May 4, 2015

Suppress Automatic updates in Skype


Create one exe in the name of SkypeSetup.exe


Copy SkypeSetup.exe to %TEMP%(C:\Users\administrator\AppData\Local\Temp)






Deny permission for "Everyone"



Deny permission for Everyone by using command line:

Icacls.exe %TEMP%\SkypeSetup.exe /deny Everyone:D

Monday, March 23, 2015

Uninstall IE11 package from SCCM 2007


For x86:

Create CMD file with the below command.

FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*11.*.mum /c "cmd /c echo Uninstalling package @fname && start /w pkgmgr /up:@fname /quiet /norestart

For x64:

Create CMD file with the below command.

MKDIR "%SYSTEMDRIVE%\temp\IE11"
%~dps0IE11-Windows6.1-x64-en-us.exe /X:%systemdrive%\temp\IE11
%systemroot%\SysNative\pkgmgr.exe /up /m:%systemdrive%\temp\ie11\IE-Win7.cab /quiet /norestart

RMDIR %SYSTEMDRIVE%\temp\IE11 /s /q

Sunday, January 18, 2015

Internet Explorer 11 package creation for x86 & x64


IE 11 Installation:

Installprerequisite:

KB2533623
KB2834140
KB2786081
KB2731771
KB2729094
KB2670838

Extract IE EXE into temp folder.

Run MSU with the help of DISM tool.

After the prerequisite we required restart for the installation of IE11-Windows6.1-x86-en-us.exe. Inorder to avoid the restart we are extracting the exe into temp folder and executing the msu using dism tool.

After the installation of prerequisite and MSU.Restart the machine for the proper functionality of the application.

Set up internet explorer prompt - To avoid the prompt add the below key

REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v DisableFirstRunCustomize /t REG_DWORD /d 1 /f

To suppress automatic update:

REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v EnableAutoUpgrade /t REG_DWORD /d 0 /f

For x64:

Create CMD file.

MKDIR "C:\temp\IE11"
"%~dps0Windows6.1-KB2533623-x64.msu" /quiet /norestart
"%~dps0Windows6.1-KB2834140-v2-x64.msu" /quiet /norestart
"%~dps0Windows6.1-KB2786081-x64.msu" /quiet /norestart
"%~dps0Windows6.1-KB2731771-x64.msu" /quiet /norestart
"%~dps0Windows6.1-KB2729094-v2-x64.msu" /quiet /norestart
"%~dps0Windows6.1-KB2670838-x64.msu" /quiet /norestart
%~dps0IE11-Windows6.1-x64-en-us.exe /X:%systemdrive%\temp\IE11
%systemroot%\SysNative\dism.exe /Online /Add-Package /PackagePath:%systemdrive%\temp\IE11\IE-Win7.CAB /quiet /norestart
%systemroot%\SysNative\wusa.exe "%systemdrive%\temp\IE11\IE-Spelling-en.MSU" /quiet /norestart
%systemroot%\SysNative\wusa.exe "%systemdrive%\temp\IE11\IE-Hyphenation-en.MSU" /quiet /norestart
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v DisableFirstRunCustomize /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v EnableAutoUpgrade /t REG_DWORD /d 0 /f
RMDIR C:\temp\IE11 /s /q

For x86:

Create CMD file.

MKDIR "C:\temp\IE11"
"%~dps0Windows6.1-KB2533623-x86.msu" /quiet /norestart
"%~dps0Windows6.1-KB2834140-v2-x86.msu" /quiet /norestart
"%~dps0Windows6.1-KB2786081-x86.msu" /quiet /norestart
"%~dps0Windows6.1-KB2731771-x86.msu" /quiet /norestart
"%~dps0Windows6.1-KB2729094-v2-x86.msu" /quiet /norestart
"%~dps0Windows6.1-KB2670838-x86.msu" /quiet /norestart
%~dps0IE11-Windows6.1-x86-en-us.exe /X:%systemdrive%\temp\IE11
%systemroot%\system32\dism.exe /Online /Add-Package /PackagePath:%systemdrive%\temp\IE11\IE-Win7.CAB /quiet /norestart
%systemroot%\system32\wusa.exe "%systemdrive%\temp\IE11\IE-Spelling-en.MSU" /quiet /norestart
%systemroot%\system32\wusa.exe "%systemdrive%\temp\IE11\IE-Hyphenation-en.MSU" /quiet /norestart
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v DisableFirstRunCustomize /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN" /v EnableAutoUpgrade /t REG_DWORD /d 0 /f
RMDIR C:\temp\IE11 /s /q

Sunday, January 11, 2015

Enabling ISS features in windows 7 using command line


Create bat file:

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-IIS6ManagementCompatibility /featurename:IIS-Metabase /featurename:IIS-ManagementService /featurename:IIS-ApplicationDevelopment /featurename:IIS-NetFxExtensibility /featurename:IIS-ASP /featurename:IIS-ASPNET /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter /featurename:IIS-ServerSideIncludes /featurename:IIS-CommonHttpFeatures /featurename:IIS-DefaultDocument /featurename:IIS-DirectoryBrowsing /featurename:IIS-HttpErrors /featurename:IIS-HttpRedirect /featurename:IIS-StaticContent /featurename:IIS-HealthAndDiagnostics /featurename:IIS-HttpLogging /featurename:IIS-RequestMonitor /featurename:IIS-Performance /featurename:IIS-HttpCompressionStatic /featurename:IIS-Security /featurename:IIS-BasicAuthentication /featurename:IIS-RequestFiltering /featurename:IIS-WindowsAuthentication /featurename:IIS-URLAuthorization /featurename:IIS-IPSecurity /featurename:IIS-DigestAuthentication /featurename:IIS-ClientCertificateMappingAuthentication /featurename:IIS-IISCertificateMappingAuthentication /featurename:IIS-ManagementConsole /featurename:IIS-ManagementScriptingTools /featurename:IIS-WMICompatibility /featurename:IIS-CGI /featurename:IIS-LegacyScripts /featurename:IIS-LegacySnapIn