software installs and DependsON

This topic contains 7 replies, has 4 voices, and was last updated by Profile photo of Nitin Gupta Nitin Gupta 2 months, 3 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #45115
    Profile photo of Efff dd
    Efff dd
    Participant

    Hello
    not sure how to tell 'Something by Someone' needs to be installed first using the depondson.
    maybe DependsOn = “[Package]Something1”

    Packages = @(
    ProductID = {C58378BC-0B7B-474E-855C-0000000000}
    Name = 'Something1 '
    path = '\\domain.com\files\Hosting\Package\Installer1.msi'
    Shortname = 'Some'

    ProductID = {C58378BC-0B7B-474E-855C-1100000000}
    Name = 'Microsoft Runtime'
    path = '\\domain.com\files\Hosting\Package\Installer2.msi'
    Shortname = 'Ms Runtime'
    DependsOn = " ?????????"
    )

    #45124
    Profile photo of Don Jones
    Don Jones
    Keymaster

    I'm not certain what that syntax is meant to do. I'm more used to seeing:

    Package SomethingOne {
     ProductID = {C58378BC-0B7B-474E-855C-0000000000}
     Name = 'Something1'
     path = '\\domain.com\files\Hosting\Package\Installer1.msi'
     Shortname = 'Some'
    }
    Package MSRuntime {
     ProductID = {C58378BC-0B7B-474E-855C-1100000000}
     Name = 'Microsoft Runtime'
     path = '\\domain.com\files\Hosting\Package\Installer2.msi'
     Shortname = 'Ms Runtime'
     DependsOn = " [Package]SomethingOne"
    }
    
    #45154
    Profile photo of Efff dd
    Efff dd
    Participant

    this is what I currently have to push installs. I don't have each package named like Sometingone or MSruntime as your example shows.

    Packages = @( #Packages on all nodes.
    @{
    ShortName = "symantec"
    Name = "scan Client"
    Path = "\\domain.com\files\hosting\Config\Package\scan-June24-14.msi"
    ProductID = "ECEA7878-2100-4525-915D-B09174E36971"
    }

    @{
    ShortName = 'ServerGAC'
    Name = 'ServerGACInstaller1'
    Path = '\\domain.com\files\hosting\Config\Package\ServerGACInstaller1.msi'
    ProductID = '6E25BE84-EC08-4151-91F3-00000'
    }

    @{
    ShortName = "URLRewrite2"
    Name = "IIS URL Rewrite Module 2"
    Path = "\\domain.com\files\hosting\Config\Package\rewrite_2.0.msi"
    ProductID = "EB675D0A-2C95-405B-BEE8-0000000"
    }
    @{
    ShortName = 'MySQL31'
    Name = 'MySQL Connector/ODBC'
    Path = '\\domain.com\files\hosting\Config\Package\mysql-connector-odbc2.msi'
    ProductID = 'BBFD9BC5-BB9A-4F9C-AD77-000'

    )
    MimeTypes = @(
    @{
    FileExtension = '.woff'
    Ensure = 'Present'
    }

    )
    CustomErrorFolders = @(
    @{
    Name = 'WebServices'
    Authors = 'DR_Weboperator'
    }
    )
    }

    • This reply was modified 3 months ago by Profile photo of Efff dd Efff dd.
    • This reply was modified 3 months ago by Profile photo of Efff dd Efff dd.
    #45202
    Profile photo of Kyle Berger
    Kyle Berger
    Participant

    That's just an array of Hash Tables. You have to use Resources inside Configurations in order to actually get DSC to do something.

    I would suggest using a Composite Resource, but that might be too advanced for now.

    Don is talking about this: https://msdn.microsoft.com/en-us/powershell/dsc/packageresource

    Make sure you fully understand the documentation on configurations before doing anything else: https://msdn.microsoft.com/en-us/powershell/dsc/configurations

    #45206
    Profile photo of Kyle Berger
    Kyle Berger
    Participant

    Oh yea, you're the guy that likes to use PSD1 files for generating all of your configurations.

    Something like this:

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

    You indeed are creating exactly what Don is saying.

    "Package $PackageName" is the same as "[Package]$PackageName" when referencing the resource's "name" – so to speak.

    That must be 100% unique, so you can reference any and all resource items uniquely.

    Now what you can do is add DependsOn in your PSD1 and change the script to something like this:

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

    I hope that helps.

    • This reply was modified 3 months ago by Profile photo of Kyle Berger Kyle Berger.
    #45285
    Profile photo of Efff dd
    Efff dd
    Participant

    thank you.
    that's me – inherited a huge DSC config.
    not sure why I have a ps1 and psd1 files?

    #45625
    Profile photo of Kyle Berger
    Kyle Berger
    Participant

    There's nothing wrong with doing it that way, but it seems mildly unnecessary.

    You can just create a Composite Resource and include that instead, but whatever floats your boat.

    #45833
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

    Using 'if' inside Package resource won't work. You will have to move it outside the package block.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.