Invalid method Parameter when calling DfsrConnectionInfo->ForceReplication() with WMIC

dfs-rreplicationsysvolwmi

In our AD infrastructure the SYSVOL is replicated by DFSR. I want to force replication using WMI (ForceReplication method) via WMIC:

wmic /namespace:\\root\microsoftdfs path DfsrConnectionInfo call ForceReplication(15,10,2)

But this fails with:

Executing (DfsrConnectionInfo)->ForceReplication()
ERROR:
Description = Invalid method Parameter(s)

I double checked the argument order/type:

wmic /namespace:\\root\microsoftdfs path DfsrConnectionInfo call ForceReplication /?
Call                    [ In/Out ]Params&type                   Status
====                    =====================                   ======
ForceReplication        [IN ]Bandwidth(uint32)                  Implemented

                        [IN ]DurationInMin(uint32)

                        [IN ]Mode(uint32)

                        [OUT]ReturnValue(uint32)

The same call in Powershell works:

(gwmi -Namespace root\microsoftdfs -Class DfsrConnectionInfo).ForceReplication(2, 10, 15)

Where am I wrong with WMIC and arguments?

Best Answer

The first argument. 15 isn't valid. The one that works doesn't surprise me. The reason is that the first parameter is between 1 and 4 (inclusive). This is different from the first wmic code you show:

wmic /namespace:\\root\microsoftdfs path DfsrConnectionInfo call ForceReplication(15,10,2)

The first value in the parentheses 15 isn't a valid value. It must be 1, 2, 3, or 4. For detailed information about this, you can review this Microsoft article.