Friday, May 4, 2018

SCCM: Re-Push Pull Distribution Point




I have a lot of Pull Distributiont Point to manage (near 3000..). My problem is people around the world managing Pull Distribution Point computers are not always IT. Sometimes, they remove folder for "good" reasons or whatever. And sometimes it is SCCM which makes some impressive bugs...

An example below: I checked share on this Pull Distribution Point

Get-WmiObject -ComputerName PULLDPNAME -Class win32_share


 As you can see below, on PULLDPNAME, if you check real path, NO MORE SMS_DP$ share in E:\SMS_DP$...



or that thing: SMS-DP$ exist but NO MORE SMS sub folder...


or this thing:
Product: ConfigMgr Distribution Point -- Error 1706. An installation package for the product ConfigMgr Distribution Point cannot be found. Try the installation again using a valid copy of the installation package 'pulldp.msi'.




You know what ? I am really bored to uninstall and re-install  Pull Distribution Point each time (we have a lot of sites with slow bandwidth...).
So, as a bad boy, I searched how to re-install Pull DP as Microsoft does not give this option.
And I found something interesting.

I first create NO_SMS_ON_DRIVE.SMS on all drive EXCEPT the one which will be the good one for PullDP content.


Then I also check freespace and display only disk drive (NOT usb drive) using:
  Get-WmiObject -ComputerName PULLDPNAME -Class win32_logicaldisk -Filter " DriveType=3 " | Select DeviceID, @{Name='FreeSpace(GB)';Expression={  [math]::Round($_.FreeSpace/1GB,2) }},@{Name='Size(GB)';Expression={ [math]::Round($_.Size/1GB,2)}}


And now I verify PullDP State. For that I found that DistributionPoints table was THE reference  (WARNING: you MUST run these next queries on your Secondary SQL if your PullDP is on a Secondary, and use SQL queries on your Primary if your PullDP is attached on your Primary)

WARNING: USE SQL QUERIES IS NOT SUPPORTED BY MICROSOFT. Do not use queries on Production. Here is is just information to know how work SCCM.

SELECT DPID,IsPullDPInstalled,State,ServerName
from DistributionPoints
where 1=1
AND ServerName like '%PULLDPNAME%'
--Get infos for PULLDPNAME

As you can see IsPullDPInstalled and State field with 1 value permit to indicate PullDP is installed.






After some research I found if we change these 2 values to 0 that permit to re-run PullDP installation 
Something like:

SELECT DPID,IsPullDPInstalled,State,ServerName
from DistributionPoints
where 1=1
AND ServerName like '%PULLDPNAME%'
--Get infos for PULLDPNAME

UPDATE DistributionPoints
SET IsPullDPInstalled = '0', State = '0'
WHERE ServerName like '%PULLDPNAME%'

SELECT DPID,IsPullDPInstalled,State,ServerName
from DistributionPoints
where 1=1
AND ServerName like '%PULLDPNAME%'
--Get infos for PULLDPNAME








After some minutes DP State come back to state 1

And now Distribution Point Configuration Status indicate that DP installed :)

we can see DistMgr.log
~Processing 98.INS 
~DPID 98 - NAL Path ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ , ServerName = MYPULLDP.MYDOMAIN.NET, DPDrive = , IsMulticast = 0, PXE = 0, RemoveWDS = 0 
PullDP ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ is marked Uninstalled 
user(NT AUTHORITY\SYSTEM) runing application(SMS_DISTRIBUTION_MANAGER) from machine (MYSECONDARY.MYDOMAIN.NET) is submitting SDK changes from site(SEC) 
target processor architecture is x64~ 
Installed file on MYPULLDP.MYDOMAIN.NET, copied E:\Program Files\Microsoft Configuration Manager\bin\x64\..\x64\ContentAuthModule.dll to \\MYPULLDP.MYDOMAIN.NET\ADMIN$\system32\inetsrv\ContentAuthModule.dll 
target processor architecture is x64~ 
Installed file on MYPULLDP.MYDOMAIN.NET, copied E:\Program Files\Microsoft Configuration Manager\bin\x64\..\x64\smsfileisapi.dll to \\MYPULLDP.MYDOMAIN.NET\ADMIN$\system32\inetsrv\smsfileisapi.dll 
Found .ins file for remote server ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\, will try to verify the selected drive and install DP files on this server 
~Try to create folder SMS_DP$ on drive D:\ on server MYPULLDP.MYDOMAIN.NET 
~The drive share \\MYPULLDP.MYDOMAIN.NET\D$\ is accessible. 
~Successfully created SMS_DP$ directory at - \\MYPULLDP.MYDOMAIN.NET\D$\SMS_DP$. 
~Successfully created share SMS_DP$ on server MYPULLDP.MYDOMAIN.NET 
DP share SMS_DP$ already exist on the remote DP~ 
For server MYPULLDP.MYDOMAIN.NET processor architecture is x64~ 
Install Internet server= 3 
~Command line to install IIS: 'dism.exe /online /norestart /enable-feature /ignorecheck /featurename:"IIS-WebServerRole" /featurename:"IIS-WebServer" /featurename:"IIS-CommonHttpFeatures" /featurename:"IIS-StaticContent" /featurename:"IIS-DefaultDocument" /featurename:"IIS-DirectoryBrowsing" /featurename:"IIS-HttpErrors" /featurename:"IIS-HttpRedirect" /featurename:"IIS-WebServerManagementTools" /featurename:"IIS-IIS6ManagementCompatibility"  /featurename:"IIS-Metabase" /featurename:"IIS-WindowsAuthentication"  /featurename:"IIS-WMICompatibility"  /featurename:"IIS-ISAPIExtensions" /featurename:"IIS-ManagementScriptingTools" /featurename:"MSRDC-Infrastructure" /featurename:"IIS-ManagementService" '. 
~OS version 6.3.9600: installed IIS on remote server MYPULLDP.MYDOMAIN.NET. 
user(NT AUTHORITY\SYSTEM) runing application(SMS_DISTRIBUTION_MANAGER) from machine (MYSECONDARY.MYDOMAIN.NET) is submitting SDK changes from site(SEC) 
STATMSG: ID=2362 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_DISTRIBUTION_MANAGER" SYS=MYSECONDARY.MYDOMAIN.NET SITE=SEC PID=2916 TID=11960 GMTDATE=mar. déc. 11 14:41:12.020 2018 ISTR0="MYPULLDP.MYDOMAIN.NET" ISTR1="0" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=1 AID0=404 AVAL0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" 
StateTable::CState::Handle - (2362:1 2018-12-11 14:41:12.020+00:00) >> (2364:1 2018-09-12 06:23:24.906+00:00) 
Inbox source is local on MYSECONDARY 
CStateMsgReporter::DeliverMessages - Queued message: TT=1401 TIDT=0 TID='4618D922-D9FB-4D11-A4AE-5703EA77AEDF' SID=2362 MUF=0 PCNT=2, P1='SEC' P2='2018-12-11 14:41:12.020+00:00' P3='' P4='' P5='' 
CStateMsgReporter::DeliverMessages - Created state message file: E:\Program Files\Microsoft Configuration Manager\inboxes\auth\statesys.box\incoming\xkrggttj.SMX  
Successfully send state change notification 4618D922-D9FB-4D11-A4AE-5703EA77AEDF 
OS information for the server - 6.3.9600 
OS information for the server - 6.3.9600, ProductType=3 
Failed to get dependent services of wdsserver 
Failed to get dependent services of sccmpxe 
File to copy: smscore.dll 
Successfully copied: smscore.dll 
File to copy: ccmgencert.dll 
Successfully copied: ccmgencert.dll 
File to copy: smspxe.dll 
Successfully copied: smspxe.dll 
File to copy: sccmpxe.exe 
Successfully copied: sccmpxe.exe 
File to copy: ccmcore.dll 
Successfully copied: ccmcore.dll 
File to copy: CCMUtilLib.dll 
Successfully copied: CCMUtilLib.dll 
File to copy: TSMessaging.dll 
Successfully copied: TSMessaging.dll 
File to copy: tscore.dll 
Successfully copied: tscore.dll 
File to copy: CommonUtils.dll 
Successfully copied: CommonUtils.dll 
File to copy: ccmperf.dll 
Successfully copied: ccmperf.dll 
Configure MSXML 6.0 on DP MYPULLDP.MYDOMAIN.NET 
MSXML 6.0 is configured on DP MYPULLDP.MYDOMAIN.NET successfully 
Run command 'D:\SMS_DP$\sms\bin\vcredist_x64.exe /q /norestart /log "D:\SMS_DP$\sms\bin\vcredist.log"' to install VC redist 
~Successfully installed DP WMI provider on the remote distribution point 
Failed to configure IIS module, GLE - 1168 
ConfigureIISModules failed to configure IIS module 
SQL MESSAGE: spProcessCcmCertBindingState - Updating CM_RoleSSLCertificates for MYPULLDP.MYDOMAIN.NET state=1 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Acquired registry mutex. 
~Port = 80 
~Adding Port = 80 
~Successfully updated the  port list in IIS. 
~Successfully started the default website. 
~SSL is not required. Skipping prerequisite checks for SSL. 
target processor architecture is x64~ 
target processor architecture is x64~ 
~Successfully created the virtual directory SMS_DP_SMSPKG$ for the physical path D:\SCCMContentLib.~ 
~Failed to delete file extension C:\WINDOWS\system32\inetsrv\smsfileisapi.dll. 
~Successfully added file extension C:\WINDOWS\system32\inetsrv\smsfileisapi.dll. 
~Failed to remove application dependency - SMS Distribution Point | SMS_DP. 
~Acquired registry mutex. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~The  port list has not changed. DM will not modify the SMS Port List. 
~SSL is not required. Skipping prerequisite checks for SSL. 
target processor architecture is x64~ 
target processor architecture is x64~ 
~Successfully created the virtual directory SMS_DP_SMSSIG$ for the physical path \\MYPULLDP.MYDOMAIN.NET\SMSSIG$.~ 
~Successfully added file extension C:\WINDOWS\system32\inetsrv\smsfileisapi.dll. 
~Acquired registry mutex. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Creating, reading or updating IIS registry key for a distribution point. 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
~Acquired registry mutex. 
STATMSG: ID=2375 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_DISTRIBUTION_MANAGER" SYS=MYSECONDARY.MYDOMAIN.NET SITE=SEC PID=2916 TID=11960 GMTDATE=mar. déc. 11 14:43:04.150 2018 ISTR0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" ISTR1="" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=1 AID0=404 AVAL0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" 
Configure IIS virtual directories successfully on the distribution point MYPULLDP.MYDOMAIN.NET 
Initialize monitoring task on MYPULLDP.MYDOMAIN.NET 
DP settings have been updated to MYPULLDP.MYDOMAIN.NET. 
Initialize usage gathering task on MYPULLDP.MYDOMAIN.NET 
DP settings have been updated to MYPULLDP.MYDOMAIN.NET. 
No DMP found.. 
ConfigureDP 
~IISPortsList in the SCF is "80". 
~IISSSLPortsList in the SCF is "443". 
~IISWebSiteName in the SCF is "". 
~IISSSLState in the SCF is 448. 
DP registry settings have been successfully updated on MYPULLDP.MYDOMAIN.NET 
STATMSG: ID=9501 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_DISTRIBUTION_MANAGER" SYS=MYSECONDARY.MYDOMAIN.NET SITE=SEC PID=2916 TID=11960 GMTDATE=mar. déc. 11 14:43:10.196 2018 ISTR0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" ISTR1="" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=1 AID0=404 AVAL0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" 
STATMSG: ID=9503 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_DISTRIBUTION_MANAGER" SYS=MYSECONDARY.MYDOMAIN.NET SITE=SEC PID=2916 TID=11960 GMTDATE=mar. déc. 11 14:43:10.212 2018 ISTR0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" ISTR1="" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=1 AID0=404 AVAL0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" 
ConfigurePXE 
Creating, reading and or updating Operations Management server role registry keys for a Distribution Point ... 
PullDP ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ is marked Uninstalled 
user(NT AUTHORITY\SYSTEM) runing application(SMS_DISTRIBUTION_MANAGER) from machine (MYSECONDARY.MYDOMAIN.NET) is submitting SDK changes from site(SEC) 
user(NT AUTHORITY\SYSTEM) runing application(SMS_DISTRIBUTION_MANAGER) from machine (MYSECONDARY.MYDOMAIN.NET) is submitting SDK changes from site(SEC) 
STATMSG: ID=2399 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_DISTRIBUTION_MANAGER" SYS=MYSECONDARY.MYDOMAIN.NET SITE=SEC PID=2916 TID=11960 GMTDATE=mar. déc. 11 14:43:16.431 2018 ISTR0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" ISTR1="MYPULLDP.MYDOMAIN.NET" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=1 AID0=404 AVAL0="["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\" 
~DPID 98 - NAL Path ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ , ServerName = MYPULLDP.MYDOMAIN.NET, DPDrive = , IsMulticast = 0, PXE = 0, RemoveWDS = 0  $
ConfigurePullDP 
~NAL Path ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ is a Pull DP 
For server MYPULLDP.MYDOMAIN.NET processor architecture is x64~ 
Installing PullDP, check \\MYPULLDP.MYDOMAIN.NET\SMS_DP$\sms\logs\smsdpprov.log and \\MYPULLDP.MYDOMAIN.NET\SMS_DP$\sms\logs\pulldp_install.log 
PullDP ["Display=\\MYPULLDP.MYDOMAIN.NET\"]MSWNET:["SMS_SITE=SEC"]\\MYPULLDP.MYDOMAIN.NET\ is marked Installed 
 


To be sure all is OK, redistribute 1 package (\Administration\Overview\Site Configuration\Servers and Site System Roles for printscreen but script is better :) because after you perhaps need to redistribute all package again  -> please verify all seems work correctly after on your PullDP)


And now all seems OK





Good. Now, I can Re-Push Pull Distribution Point :)

Saturday, March 3, 2018

SCCM Bug: Push Client - ERROR: Unable to access target machine for request - Error 1003 - ccm.log

If you have error "Unable to access target machine for request" with error code "1003" in your "Microsoft Configuration Manager\Logs\ccm.log" on your secondary or your primary

...
======>Begin Processing request: "2097199533", machine name: "MYMACHINE"  $$ <03-01-2018 18:27:05.821-480="">
Execute query exec [sp_IsMPAvailable] N'SEC'~  $$ <03-01-2018 18:27:05.822-480="">
---> ERROR: Unable to access target machine for request: "2097199533", machine name: "MYMACHINE",  access denied or invalid network path.  $$ <03-01-2018 18:27:05.823-480="">

Execute query exec [sp_CP_SetLastErrorCode] 2097199533, 1003~  $$ <03-01-2018 18:27:05.824-480="">
Stored request "2097199533", machine name ""MYMACHINE", in queue "Retry".  $$ <03-01-2018 18:27:05.827-480="">
Execute query exec [sp_CP_SetPushRequestMachineStatus] 2097199533, 2~  $$ <03-01-2018 18:27:05.831-480="">
Execute query exec [sp_CP_SetLatest] 2097199533, N'03/01/2018 10:27:05', 194~  $$ <03-01-2018 18:27:05.842-480="">
<======End request: "2097199533", machine name: ""MYMACHINE".  $$ <03-01-2018 18:27:05.851-480="">
....

<03-01-2018 18:27:05.824-480=""> <03-01-2018 18:27:05.827-480=""> <03-01-2018 18:27:05.831-480=""> <03-01-2018 18:27:05.842-480=""> <03-01-2018 18:27:05.851-480="">  
Instead of:

...
======>Begin Processing request: "2097199533", machine name: "MYMACHINE"  $$ <03-01-2018 18:51:25.981-480="">
Execute query exec [sp_IsMPAvailable] N'SEC'~  $$ <03-01-2018 18:51:25.987-480="">
---> Trying the 'best-shot' account which worked for previous CCRs (index = 0x0)~  $$ <03-01-2018 18:51:25.988-480="">
---> Attempting to connect to administrative share '\\MYMACHINE.mydomain.net\admin$' using account 'MYDOMAIN\AdminAll'~  $$ <03-01-2018 18:51:25.988-480="">
...

Error 1003 normally is: "Cannot complete this function." but here it is a SCCM Bug (CB 1706 and 1710. Perhaps before and after)



Resolution: (Do it on your Primary SQL server, Secondary will do synchronization)

1st: get all client with 1003 error:
SELECT * FROM ClientPushMachine_G
WHERE 1=1
AND LastErrorCode = '1003'

(and save these informations to create a collection to re-push client)

2nd:delete all line with 1003 error : (WARNING: modify database directly is NOT permit by Microsoft - backup your database before any modifications)
DELETE FROM ClientPushMachine_G
WHERE 1=1
AND LastErrorCode = '1003'


3rd:re-push you clients
All should be OK now

Wednesday, February 28, 2018

IIS HTTP Error 503 due to Limits in our SCCM Distribution Point

One of our IIS server have HTTP Error 503 (a SCCM Distribution Point)


Multiple check....All Seems OK.....
After some research, we found a colleague modified "Limits" in "Default Web Site" like these screenshots:



He checked "Limit bandwidth usage" (this is NOT the problem) but he checked "Limit number of connections" and set low value (50 is too low for this application, there is more connections all day long)




Normally, there is NO limitation in "Default Web Site" as below screenshot:


Reinitializing parameter (uncheck "limit number of connections"), and now IIS is OK



Conclusion:
Does not modify IIS "Limit number of connections" if you don't have a real good reason (license reason for example) and only if you must know how many users use your application in same time.
You can use "Limit bandwidth usage" to limit bandwidth usage if you need to restrict Distribution Point bandwidth (reason:VPN, low bandwidth cable use by multiple application...)

Tuesday, May 14, 2013

Powershell Internationalization

When you need you script work in all computers around the world, please define a cultureinfo ("en-US" cultureinfo for example)
(below an example in my 'french' computer)
$date = Get-Date            
$culture = New-Object System.Globalization.cultureinfo("en-US")         
$date
samedi 4 mai 2013 09:55:18


$date.Tostring("dddd",$culture)
Saturday


$date.Tostring("D",$culture)
Saturday, May 04, 2013


$culture = New-Object System.Globalization.cultureinfo("fr-FR")
$date
samedi 4 mai 2013 09:55:18


$date.Tostring("dddd",$culture)
samedi


$date.Tostring("D",$culture)
samedi 4 mai 2013


Culture List here or in this old cultureinfo Framework information.To play with different pattern culture go to datetimeformatinfo