Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: $Allnodes.foreach examples

$
0
0

thanks Jacob much appreciated, hopefully the example below shows what we are trying to do.

At the moment we are using just a standard foreach() statement and just enumerating through the windows features in our array $features .

Basically Is it possible to use the $Allnodes.Foreach() statement in a similar fashion but using the array stored in the hash table key Winfeatures within the configdata and do something like $ALLnodes.foreach($_.Winfeatures)

and use this to assign to the Name = $feature.

$configdata = @{
 
    AllNodes = @(
        @{  NodeName = "dscw2k8";
            Cluster = "SERVERX";
            Winfeatures =  @("NET-Framework-Core","NET-HTTP-Activation","Web-Static-Content","Web-Default-Doc",
	        "Web-Dir-Browsing","Web-Http-Errors","Web-Asp-Net","Web-Net-Ext","Web-ISAPI-Ext",
	        "Web-ISAPI-Filter","Web-Includes","Web-Http-Logging","Web-Log-Libraries","Web-Request-Monitor",
	        "Web-Http-Tracing","Web-Mgmt-Tools","Web-Scripting-Tools","Web-Mgmt-Service")
        }
 
    )
 
}
 
 
configuration netserverWindowsFeatures
{
 
$features = "NET-Framework-Core","NET-HTTP-Activation","Web-Static-Content","Web-Default-Doc",
	        "Web-Dir-Browsing","Web-Http-Errors","Web-Asp-Net","Web-Net-Ext","Web-ISAPI-Ext",
	        "Web-ISAPIFilter","Web-Includes","Web-Http-Logging","Web-Log-Libraries","Web-Request-Monitor",
	        "Web-Http-Tracing","Web-Mgmt-Tools","Web-Scripting-Tools","Web-Mgmt-Service"
 
 
    foreach($feature in $features)
    {
        Node $AllNodes.Where{$_.Cluster -eq "SERVERX"}.Nodename
        {
            WindowsFeature $feature
            {
                Name = $feature
                Ensure = "Present"
            }
            Log "netserverWindowsFeatures-$feature"
            {
                Message = "netserverWindowsFeatures Windows $feature updated"
                #DependsOn = "[WindowsFeature]"
            }
 
        }
    }
 
 
}
netserverWindowsFeatures -outputpath c:\mof\sample_NETAPPB -configuration $configdata

Viewing all articles
Browse latest Browse all 13067

Trending Articles