I would like to get the assigned site, set it and get it again to make sure it changed. I got this from the web:
$([WmiClass]"\\ny7D20360\ROOT\ccm:SMS_Client").GetAssignedSite()| Select sSiteCode $([WmiClass]"\\ny7D20360\ROOT\ccm:SMS_Client").SetAssignedSite("exe",$null)
errors with get:
So, this is really more an SCCM question, unfortunately, but what it's telling you is that it can't find a version of SetAssignedSite() that accepts the two arguments you provided. I went to https://msdn.microsoft.com/en-us/library/cc146123.aspx, and it seems to want a site code as a string (like "exe" I suppose), but then it wants a long integer as a set of flags. You might try passing a zero instead of $null?
This is really outside PowerShell per se, and even worse it's an old COM class (the docs are from 2009!). COM doesn't always intro cleanly with .NET and PowerShell, so it may take some fiddling to figure out. It could also be a problem with the version of SCCM you're using – the docs indicate compatibility with 2007, but nothing later.
You must be logged in to reply to this topic.