0
어떻게이 논리를 powershell에서 사용할 수 있습니까?foreach가 powershell에 로그인했습니다.
$i = ("SharePointCDPTestProject1_Feature1", "SharePointCDPTestProject1_Feature2", "SharePointCDPTestProject1_Feature3");
$a = Get-SPSite http://localhost/sts*;
Foreach($id in $i)
{
Foreach($p in $a)
{
Enable-SPFeature –identity $id -URL $p
}
}
죄송합니다 .. 나는 PS에 멍청한 놈
를 ForEach-객체 해요 : 매개 변수 '프로세스'를 결합 할 수 없습니다. "System.String"유형의 "{"값을 "System.Mana gement.Automation.ScriptBlock"유형으로 변환 할 수 없습니다. 줄에서 : 1 문자 : 13 + $ i | foreach는 <<<< + CategoryInfo : InvalidArgument : (:) [를 ForEach-오브젝트, ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage, Microsoft.PowerShell.Commands.ForEachObjectCommand – user1235794
오타 오류 코드가 –
$ I = ("SharePointCDPTestProject1_Feature1를"편집 " SharePointCDPTestProject1_Feature2 ","SharePointCDPTestProject1_Feature3 "); $ a = Get-SPWebApplication "http : // localhost"| Get-SPSite - 모두 제한 | 은 Get-SPWeb -Limit 모든 의 Foreach ($의 난에서 $ 아이디) { \t의 Foreach ($ A의 $ p를) \t { \t \t 사용-SPFeature -Identity의 $ 아이디 -URL의 $의 p.Url \t을} } 나를 위해 일했습니다. – user1235794