有一个将GPO链接到OU的函数:
using Microsoft.GroupPolicy;
private void LinkTheGPO()
{
GPDomain domain = new GPDomain("city.dom");
string sOU = "LDAP://city/ou=room,ou=house,DC=city,DC=dom";
Som som = domain.GetSom(sOU); //ERROR AT THIS LINE
som.LinkGpo(-1, gpo);
}
它会抛出此错误:
Value does not fall within the expected range
我的OU结构是:
City
|
|___House
|
|____Room