Friday, October 26, 2018

CcmGetOSVersion failed with 0x80041010

Client error with this code  0x80041010 is due to the WMI issues


Please use below command to resolve this issue












  1. cleanup sccm client 
  2. Open a command prompt with elevated.
  3. Change to directory C:\Windows\system32\wbem\
  4. Run: dir /b *.mof *.mfl | findstr /v /i uninstall > moflist.txt & for /F %s in (moflist.txt) do mofcomp %s
  5. Install SCCM Client 

Wednesday, October 24, 2018

Use command to lock user to change background or wallpaper for Windows 10 (Applies to all version)


Create OSD task sequence command line and type this command after changed desktop.

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop /V NoChangingWallPaper /T REG_DWORD /D 1 /F

Find and delete specific driver from Powershell

Hi All,

Please see below how to find and delete driver using Powershell .


1. Find driver using  below command from powershell

Get-WmiObject Win32_PnPSignedDriver 

2. You may export to a text file
Get-WmiObject Win32_PnPSignedDriver >c:\driver.txt
















3. filter driver and oem
| where {$_.DeviceName -like "*NVIDIA*" -and $_.InfName -like "*oem*"} 


4. Use this command to delete

$x=Get-WmiObject Win32_PnPSignedDriver | where {$_.DeviceName -like "*NVIDIA*" -and $_.InfName -like "*oem*"} 
foreach($InfName in $x){ 
pnputil -f -d $x.InfName



Wednesday, October 17, 2018

Force ConfigMgr Compliance Baseline Evaluation on Multiple Machines with PowerShell





#Replace with name of Baseline
$BLString = "BaselineName"
 
#Replace with path to input csv (with field containing machines named Name)
$file = "c:\temp\input.csv"
 
$CountProcessed = 0
$rows = (Import-Csv $file).count
 
Import-Csv $file | ForEach-Object {
 
$ComputerName = $_."Name"
 
$CountProcessed++
$percent = (($CountProcessed/$rows)*100)
 
Cls
Write-host "$('{0:N2}' -f $percent)% complete"
 
$Online = Test-Connection -Computername $ComputerName -BufferSize 16 -Count 1 -Quiet
 
If ($Online -eq "True") {
$BLname = Get-WmiObject -ComputerName $ComputerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration | Where-Object {$_.DisplayName -match $BLString} | Select-Object -ExpandProperty Name
$version = Get-WmiObject -ComputerName $ComputerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration | Where-Object {$_.DisplayName -match $BLString} | Select-Object -ExpandProperty Version
$MC = [WmiClass]"\\$ComputerName\root\ccm\dcm:SMS_DesiredConfiguration"
 
$Method = "TriggerEvaluation"
$InParams = $mc.psbase.GetMethodParameters($Method)
$InParams.IsEnforced = $true
$InParams.IsMachineTarget = $false
$InParams.Name = "$BLname"
$InParams.Version = "$version"
$inparams.PSBase.properties | select Name,Value | Out-Null
$R = $MC.InvokeMethod($Method, $InParams, $null)
$R | Out-Null}
}
Write-Host "Processed" $CountProcessed "of" $rows


The input file should be formatted as follows:
Name
Machine 1
Machine 2
Machine 3
etc..


Original post from http://richardchesterton.com/force-configmgr-compliance-baseline-evaluation-on-multiple-machines-with-powershell/


Thursday, September 20, 2018

Some use full commands

1. Disable Adobe update

@echo off

sc config "AdobeARMservice" start= disabled
sc stop "AdobeARMservice"

reg Add "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Adobe\Adobe ARM\Legacy\Reader\{AC76BA86-7AD7-1033-7B44-AC0F074E4100}" /v "Mode" /t REG_DWORD /d 0 /f

reg Add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\Acrobat Reader\DC\FeatureLockDown" /v "bUpdater" /t REG_DWORD /d 0 /f

*******************************************************************************

2. Uninstall Java and Install

@ECHO OFF
TITLE Updating Java


::Check Current Version here
IF EXIST "C:\Program Files\Java\jre1.8.0_171" goto END


::Uninstall Older Versions here if Current Version is not installed
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
wmic product where "name like 'Java 8%%'" call uninstall /nointeractive
wmic product where "name like 'Java Auto Update%%'" call uninstall /nointeractive
wmic product where "name like 'Java(TM) 7%%'" call uninstall /nointeractive
wmic product where "name like 'Java(tm) 6%%'" call uninstall /nointeractive
wmic product where "name like 'Java(tm) 8%%'" call uninstall /nointeractive
wmic product where "name like 'J2SE Runtime Environment%%'" call uninstall /nointeractive


::Install Current Version here
msiexec.exe /i "%~dp0jre1.8.0_17164.msi"
goto END


:END
exit

*******************************************************************************
Change Registry Value for Remote Control Full Access
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control" /v "Permission Required" /t REG_DWORD /d 0 /f

How to Replace Software center icon from desktop



1. Open Notepad and copy below commands

************************************************************* 
      @echo off


del "%c:\Users\Public\Desktop\Software Centre.lnk"


XCOPY /H /s /Y "%~dp0Software Center.lnk" "c:\Users\Public\Desktop\"

****************************************************************

2. Then Save as "preferred name".bat

3. Create package with program and deploy from sccm

Tuesday, August 21, 2018

Change Site code via vbs


Change the "RH1" according to the desired site code and save as vbs file

On Error Resume Next
set oSMSClient = CreateObject ("Microsoft.SMS.Client")
'if Err.Number <>0 then
'wscript.echo "Could not create SMS Client Object - quitting"
'end if
'Assign client to Servername
oSMSClient.SetAssignedSite "RH1",0
set oSMSClient=nothing

Create a folder via cmd/batch



Copy the script below and save as *.cmd



@echo off

setlocal EnableDelayedExpansion

if not exist "C:\Drivers\" (
  mkdir "C:\Drivers\"
  if "!errorlevel!" EQU "0" (
    echo Folder created successfully
  ) else (
    echo Error while creating folder
  )
) else (
  echo Folder already exists
)


exit

The software could not be found on any servers at this time

The software could not be found on any servers at this time

Just add in the Task Sequence ID and it should give you a list of any applications that supersede Retired applications.

The Fix:-

*********************************************************************

Declare @TaskSequenceID char(8); 
set @TaskSequenceID = 'YOURTSID'

SELECT
    CI.CI_ID,
    CI.CI_UniqueID,
    CI.Manufacturer,
    CI.DisplayName,
    CI.SoftwareVersion,
    ARF.ToApplication as RetiredSupersededApp
FROM
    v_TaskSequenceAppReferencesInfo INNER JOIN
    fn_ListLatestApplicationCIs(1033) CI ON CI.CI_ID = v_TaskSequenceAppReferencesInfo.RefAppCI_ID INNER JOIN
    (
        select 
            locpropFromapp.CI_ID as FromAppCI,
            locpropFromapp.DisplayName as FromApp,
            locpropFromDT.DisplayName as FromDeploymentType,
            locpropToapp.DisplayName as ToApplication, 
            locpropToDT.DisplayName as ToDeploymentType 
        from  
            vSMS_AppRelation_Flat as appflat
            JOIN v_LocalizedCIProperties as locpropFromapp ON locpropFromapp.CI_ID = appflat.FromApplicationCIID
            JOIN v_LocalizedCIProperties as locpropFromDT ON locpropFromDT.CI_ID = appflat.FromDeploymentTypeCIID
            JOIN v_LocalizedCIProperties as locpropToapp ON locpropToapp.CI_ID = appflat.ToApplicationCIID
            JOIN v_LocalizedCIProperties as locpropToDT ON locpropToDT.CI_ID = appflat.ToDeploymentTypeCIID
            JOIN v_ConfigurationItems as ciFrom ON locpropFromapp.CI_ID = ciFrom.CI_ID
            JOIN v_ConfigurationItems as ciTo ON locpropToapp.CI_ID = ciTo.CI_ID
        where 
        appflat.RelationType=15
        --AND ciFrom.IsTombstoned = 0
        AND ciFrom.IsLatest = 1
        AND ciFrom.IsExpired = 0
        --AND 
        --ciTo.IsTombstoned = 1
        --AND ciTo.IsLatest = 1
        AND 
        ciTo.IsExpired = 1
        ) ARF ON ARF.FromAppCI = CI.CI_ID
WHERE 
    v_TaskSequenceAppReferencesInfo.PackageID = @TaskSequenceID AND
    CI.ISSuperseding = 1


Reference: http://www.asquaredozen.com/2018/04/18/task-sequence-failure-the-software-could-not-be-found-on-any-servers-at-this-time-caused-by-retired-superseded-applications/