Author Posts

June 15, 2016 at 5:52 pm

PSD1 file – I have "environment = dev"
RemovePackages = @(
@{
ShortName = "GAC_101"
Name = 'GACInstaller'
Path = "\\domain.com\files\Hosting\Config\package.msi"
ProductID = '777777-7-7-7-7-7-7'
Environment = 'Dev'
Ensure = 'Absent'

========
ps1 FILE – HOW CAN I USE THAT "ENVIRONMENT" VARIABLE NOW TO REMOVE SOFTWARE IS IT MATCHES?

foreach ($Package in $Node.RemovePackages)
{
$PackageName = "Baseline_Remove_Package_" + $Package.ShortName
Package $PackageName
{
Name = $Package.Name
Path = $Package.Path
Arguments = $Package.Arguments
ProductID = $Package.ProductID
Ensure = $Package.Ensure
}
}

June 15, 2016 at 8:48 pm

I'm sorry – I don't understand the question. I'm not familiar with using a manifest to set variables. Can I ask why you're doing that?

June 29, 2016 at 4:51 am

I think you mean:

foreach ($Package in ($Node.RemovePackages | ?{$_.Environment -eq 'Dev'}))
{
    $PackageName = "Baseline_Remove_Package_" + $Package.ShortName
    Package $PackageName
    {
        Name = $Package.Name
        Path = $Package.Path
        Arguments = $Package.Arguments
        ProductID = $Package.ProductID
        Ensure = $Package.Ensure
    }
}