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/