CircularLogArchiver v2.0

Usage : CircularLogArchiver.exe GO [/LP:LogPath] [/LE:LogExtention] [/AI:ArchiveInterval] [/AOT:ArchiveOlderThan] [/DAOT:DontArchiveOlderThan] [/DOT:DeleteOlderThan]
Example : CircularLogArchiver.exe GO /LP:”C:\Logs” /LE:”*.log” /AI:”M” /AOT:”1″ /DAOT:”3″ /DOT:”3″
Example above will archive all files in “C:\Logs” with *.log extention that are between one and three months old and delete files older than three months






Windows 10 1607 Build 14939 Error “This app can’t open”

On most installations of Windows 10 the 1607 update installs without a problem. It just happens to be that my laptop is not most installations. For one, I am using deduplication which is a server feature not to mention all my developer tools.

After installation, my deduplication stopped working which I fixed with new 14939 packages and none of my store apps worked. I fact my store didn’t even open.

Error “This app can’t open”

Managed to fix store by running wsreset.exe after which I could repair all my apps

Error 0x800F0922 or 0x800F0902 when installing SNMP Service

Had an interesting issue. Our installation of SNMP service kept failing.

The same error was shown when using PowerShell, DISM and Server manager.

Long story short, weirdly the installation is only deemed successful if the service can start, if it cannot, the whole installation is rolled back.

In our case a 3rd party app was hogging UDP 161 and SNMP failed to start hence the installation kept rolling back.

The culprit was identified by looking for the process that uses UDP 161 in output of command “NETSTAT -anb”

After killing this process installation work

Clear all Active Directory users’ manager attribute

Clear all Active Directory users’ manager attribute. See POC video

Option Explicit

Dim adoCommand
Dim adoConnection
Dim objRootDSE
Dim strDNSDomain
Dim strBase
Dim strFilter
Dim strAttributes
Dim strQuery
Dim adoRecordset
Dim strDN
Dim objUser
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
' Filter for users
strFilter = "(&(objectCategory=person)(objectClass=user))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
Do Until adoRecordset.EOF
    ' Retrieve values.
    strDN = adoRecordset.Fields("distinguishedName").Value
    ' Bind to the user object.
    Set objUser = GetObject("LDAP://" & strDN)
    ' Clear the manager attribute.
    objUser.PutEx ADS_PROPERTY_CLEAR, "manager", 0
    ' Save change to AD.
    ' Move to the next record in the recordset.
' Clean up.

BizTalk – WCF-SQL Issues

Just some issues I experienced using WCF-SQL…

Error: Value cannot be null


Solution: Specify a SOAP Action Header. This can also be found in the XSD of the generated metadata



Error: Received unexpected message type, does not match expected type


Solution: Change the receive pipeline to XMLReceive


BizTalk how to use same message inside and outside loop

  1. Create two Orchestration messages of same type. In this case I refer to them as Message1 and Message2
  2. Create a Orchestration variable of type System.Xml.Document. Tn this case I refer to it as xmlDocument
  3. Construct Message1 outside, before the loop with a Transform ect.
  4. Inside loop, within a single Construct Shape:
    1. Assign xmlDocument to Message2
    2. Manipilate Message2
    3. Assign Message2 to xmlDocument
  5. Outside, after the loop, assign xmlDocument to Message1
  6. Return Message1

BizTalk – Rename Output File Based on Some Attribute in Orchestration

  1. Create an Orchestration string variable (in this case testVAR)
  2. Add assignment shape with code below
  3. Change the send location output file name to %SourceFileName%
    outputMessage = outputMessage ;
    testVAR = xpath(outputMessage,"string(/*[local-name()='SomeName1' and namespace-uri()='SomeSchema']/*[local-name()='SomeName2' and namespace-uri()='']/*[local-name()='SomeName3' and namespace-uri()='']/text())");
    outputMessage(FILE.ReceivedFileName) = testVAR + ".TXT";


Get ClientContext in SharePoint App

Add the following function

    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var regex = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)"),
            results = regex.exec(;
        return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));

Then you can use this to get ClientContext

    siteUrl = getParameterByName("SPAppWebUrl");

    var clientContext = new SP.ClientContext(siteUrl);

Screenshot and automatically save to folder

Yeah, I missed this. Maybe you did too…

When you press Windows key + Print Screen it takes a screenshot and saves it into folder call Screenshots under the My Pictures folder. Super convenient