I was massaging some code to retrieve a Strict Replication Consistency ($SRC) value for my 45 DCs and if value was null, set it to “1” but I don’t have the code to set it actually. I don’t get an error but I don’t think it accomplishes what I’m aiming for:
I’ve added my Enterprise creds via a variable since I’m getting access denied for the Invoke-Command’s but not sure it’s either efficient or necessary where I’ve added plus I get an error. I’ve double checked my creds and they are correct. With each Invoke-command/Get-ItemProperty, I keep getting a popup “Windows Powershell Credential Request…” for each DC in the pipeline and would have thought my -credential $creds would have provided this. Nonetheless, after ading these credentials manaully, the error is
the provider
Strict Replication Consistency key is empty! on DC1.com. Creating it now…
The provider does not support the use of credentials. Perform the operation again without specifying credentials.
That’s because you’re referencing the $credentials variable inside the invoke-command scriptblock. The scriptblock runs on the remote computer and has no access to variables inside your current session unless you pass them through to the invoke-command scriptblock.
That being said i don’t think you need them inside the script block but just outside.