Troubleshooting 'No Deployment Available' in iPXE Anywhere (2PXE Server) | 2pint Knowledge Base

Troubleshooting 'No Deployment Available' in iPXE Anywhere (2PXE Server)

SYMPTOMS
When you boot a system, it boots successfully into iPXE land but you then see a message stating that there are no available deployments for the device.
 
TROUBLESHOOTING STEPS
Firstly, run the 2PXE Service in 'interactive' mode. Go to the 2PXE service installation folder, find the executable (2Pint.2pxe.Service.exe), right click and select 'Run as Administrator' This will then output debug information in real-time.
 
Then, boot the system that you are troubleshooting.
 
You should see something similar to the below image:
 
 
 
 This is a fairly common troubleshooting issue, so here are some things to check and some SQL that you can run which will return the available deployments based on the MAC Address etc.
 
  • Is the Boot Image distributed to the Distribution Point where 2PXE is installed?
  • Is the Task Sequence Deployment set to be available to 'Media And PXE' clients?
  • Is all referenced content for the Task Sequence distributed to an accessible DP? 
  • Boundaries - do you have DP affinity set that might exclude the system from this DP?
 
If you have checked all of the above and it's still retuning nothing - you can  run the SQL Query below. It's basically the same as SCCM runs when you boot a system 
Just insert the correct MAC and SMBios GUID, which you can get from the interactive 2PXE session (above)
 
--#SQL QUERY TO RETURN AVAILABLE DEPLOYMENTS FOR A DEVICE
   declare @ItemKey int = 2046820353,
    @UnknownItemKeyint int = 2046820353,
    @SMBIOSGUID     nvarchar(38) = 'D8176A62-19E9-40C4-84FC-3F68AF37B598',
    @MACAddress     nvarchar(38) ='00:11:22:33:44:55',
    @DPName         nvarchar(255) = 'MYDP.MYDOMAIN.LOCAL',
    @Architecture   int = 1 -- Architecture of 1 means any, 0 means 32-bit, 9 means 64-bit
BEGIN
    SET NOCOUNT ON
 
    declare @SMBIOS nvarchar(38)
    declare @MAC    nvarchar(64)
    
    DECLARE @CurrentTimeInUTC datetime
    SET @CurrentTimeInUTC = getutcdate()
 
    set @SMBIOS = @SMBIOSGUID
    set @MAC    = @MACAddress
 
    IF (CHARINDEX ('_', @SMBIOSGUID) > 0 OR CHARINDEX ('%', @SMBIOSGUID) > 0)
        BEGIN
            IF (EXISTS (SELECT SMBIOS_GUID FROM CommonSMBIOS_GUIDs WHERE @SMBIOSGUID LIKE CommonSMBIOS_GUIDs.SMBIOS_GUID))
                SET @SMBIOS = 'Common'
        END
    ELSE
        BEGIN
            IF (EXISTS (SELECT SMBIOS_GUID FROM CommonSMBIOS_GUIDs WHERE @SMBIOSGUID = CommonSMBIOS_GUIDs.SMBIOS_GUID))
                SET @SMBIOS = 'Common'
        END
 
    IF (CHARINDEX ('_', @MACAddress) > 0 OR CHARINDEX ('%', @MACAddress) > 0)
        BEGIN
            IF (EXISTS (SELECT MACAddress FROM CommonMACAddresses WHERE @MACAddress LIKE CommonMACAddresses.MACAddress))
                SET @MAC = 'Common'
        END
    ELSE
        BEGIN
            IF (EXISTS (SELECT MACAddress FROM CommonMACAddresses WHERE @MACAddress = CommonMACAddresses.MACAddress))
                SET @MAC = 'Common'
        END
 
    SELECT DISTINCT MACAddress, SMBIOS_GUID, SMS_UniqueIdentifier0, LastPXEAdvertisementID, LastPXEAdvertisementTime,
           OfferID, OfferIDTime, PkgID, PackageVersion, PackagePath, BootImageID, Mandatory, Known,
           PresentTimeEnabled, ExpirationTimeEnabled, PresentTimeInUTC, ExpirationTimeInUTC
    FROM (
    SELECT @MACAddress                  AS 'MACAddress',
           @SMBIOSGUID                  AS 'SMBIOS_GUID',
           xref.GUID                    AS 'SMS_UniqueIdentifier0',
           ''                           AS 'LastPXEAdvertisementID',
           ''                           AS 'LastPXEAdvertisementTime',
           sp.OfferID                   AS 'OfferID',
           po.PresentTime               AS 'OfferIDTime',
           po.PkgID                     AS 'PkgID',
           tspkg.Version                AS 'PackageVersion',
           cdp.URL                      AS 'PackagePath',
           tspkg.BootImageID            AS 'BootImageID',
           CASE
               WHEN ((po.OfferFlags & 0x00000620) != 0) THEN 1     -- 0x620 = AP_ON_LOGON | AP_ON_LOGOFF | AP_ASAP
               WHEN (ISNULL(po.MandatorySched,'')!= '') THEN 1
               ELSE 0 END
               AS 'Mandatory',
           CASE
               WHEN (EXISTS (select System_DISC.ItemKey from System_DISC where
                                System_DISC.ItemKey = xref.MachineID AND
                                ISNULL(System_DISC.Decommissioned0,0) != 0 AND
                                ISNULL(System_DISC.Obsolete0,0) != 0 AND
                                ISNULL(System_DISC.Unknown0,0) != 0))
                   THEN 0
               WHEN (xref.MachineID = @ItemKey) THEN 1
               ELSE 0 END
               AS 'Known',
           CASE WHEN ((po.TimeEnableFlag & 0x0001) != 0) THEN 1 ELSE 0 END  -- PROGOFFER_ENABLE_PRESENT = 0x0001
               AS 'PresentTimeEnabled',
           CASE WHEN ((po.TimeEnableFlag & 0x0002) != 0) THEN 1 ELSE 0 END  -- PROGOFFER_ENABLE_EXPIRATION = 0x0002
               AS 'ExpirationTimeEnabled',
           CASE WHEN ((po.TimeEnableFlag & 0x0100) != 0) THEN po.PresentTime ELSE dbo.fnConvertLocalToUTC(po.PresentTime) END  -- PROGOFFER_GMT_PRESENT = 0x0100
               AS 'PresentTimeInUTC',
           CASE WHEN ((po.TimeEnableFlag & 0x0200) != 0) THEN po.ExpirationTime ELSE dbo.fnConvertLocalToUTC(po.ExpirationTime) END -- PROGOFFER_GMT_EXPIRATION = 0x0200
               AS 'ExpirationTimeInUTC'
    FROM MachineIdGroupXRef xref
    JOIN ResPolicyMap AS rpm
        ON xref.MachineID = rpm.MachineID
    JOIN SoftwarePolicy AS sp
        ON (rpm.PADBID = sp.PADBID AND rpm.IsTombstoned != 1)
    JOIN ProgramOffers AS po
        ON sp.OfferID = po.OfferID AND po.[Action] <> 3
    JOIN vSMS_TaskSequencePackage AS tspkg
        ON (tspkg.PkgID = sp.PkgID AND (ISNULL(tspkg.BootImageID,'')!= ''))
    JOIN SMSPackages
        ON (tspkg.BootImageID = SMSPackages.PkgID)
    JOIN PkgPrograms as pp
        ON (tspkg.PkgID = pp.PkgID AND (pp.ProgramFlags & 4096) = 0 AND pp.[Action] <> 3) -- 4096 = disabled
    JOIN ContentDPMap AS cdp
        ON (cdp.ContentID = tspkg.BootImageID AND cdp.ServerName = @DPName)
    WHERE xref.MachineID IN (@ItemKey) AND
        (@Architecture = 1 OR SMSPackages.Architecture = @Architecture) AND -- Architecture of 1 means any, 0 means 32-bit, 9 means 64-bit
        ((CASE WHEN ((po.OfferFlags & 0x00000620) != 0) THEN 1  -- 0x620 = AP_ON_LOGON | AP_ON_LOGOFF | AP_ASAP
               WHEN (ISNULL(po.MandatorySched,'')!= '') THEN 1
               ELSE 0 END) = 0 OR
         (NOT EXISTS (select * from LastPXEAdvertisement as lpa where (lpa.MAC_Addresses = @MAC OR lpa.SMBIOS_GUID = @SMBIOS) AND lpa.LastPXEAdvertisementID = sp.OfferID))) AND
        (po.OfferFlags &  0x00040000) != 0      -- 0x00040000 = AP_ENABLE_TS_FROM_CD_AND_PXE
    ) AS X
    WHERE ((PresentTimeEnabled = 0 ) OR (@CurrentTimeInUTC >= PresentTimeInUTC)) AND
          ((ExpirationTimeEnabled = 0) OR (@CurrentTimeInUTC <= ExpirationTimeInUTC))
    ORDER BY Known DESC, Mandatory DESC, OfferID DESC
END