rename Deploy of the ps1 or exe

Topics: Archive - General
May 20, 2014 at 6:50 PM
Edited May 22, 2014 at 11:41 AM
Can the Deploy-Application.exe or Deploy-Application.ps1 names be changed at all? If so where in the main script would I need to change the name if at all possible? The reason I ask is I will have several different profiles that I will be creating that install different applications depending on the profile in question...
Coordinator
May 22, 2014 at 11:59 AM
Deploy-Application.ps1 can be renamed without any problem.

If I understand what you're doing however, it might make more sense to use one script with different command-line parameters. I presume there's common sections between each profile? Some something like:
  • Install common applications
  • If department = Finance, install Finance apps
  • If department = Marketing, install Marketing apps
To do this, you'd modify the Param section as follows:
[switch] $TerminalServerMode = $false,
[switch] $deptFinance = $false,
[switch] $deptMarketing = $false
Main things to note is the comma added to the $TerminalServerMode line and none on your last line - otherwise your script will fail to run.

Now, getting into the body of your script - the install section, you can split up each profile using:
# Install common apps here
Execute-MSI -Action Install -Path "MyCommonApp.msi"

# Install department specific apps
If ($deptFinance -eq $true) {

    # Install Finance apps
    Execute-MSI -Action Install -Path "MyFinanceApp.msi"

}
ElseIf ($deptMarketing -eq $true) {

    # Install Marketing apps
    Execute-MSI -Action Install -Path "MyMarketingApp.msi"

}
Hope this helps.

Dan
May 22, 2014 at 1:50 PM
That most certainly helps me a bit with some things I am looking to do similar to what dlynch said...

Basically, I I'd like to install silently and non-interactive If ($deptFinance -eq $true) or install Interactive If ($deptMarketing -eq $true)

Would this be done the same way you suggested for dlynch by creating alternate switches?
Coordinator
May 22, 2014 at 1:59 PM
Actually you don't need to modify the script to do this. Just add the DeployMode parameter when you're running it.

Deploy-Application.exe -deptMarketing

or

Deploy-Application.exe -DeployMode "Silent" -deptFinance

:)
May 28, 2014 at 11:50 AM
sintaxasn wrote:
Actually you don't need to modify the script to do this. Just add the DeployMode parameter when you're running it.

Deploy-Application.exe -deptMarketing

or

Thanks Dan,
is there a limitation on the number of parameters I can define here? IE I believe we will ultimately have over 90 profiles when all is said and Done. I am trying to convince them to automate common apps to be a required install or part of the core of our image to reduce the size of the files being pulled down to each client.
Coordinator
May 28, 2014 at 12:17 PM
Okay, let me revise my initial proposal as follows. Here's your new Param section changes:
[switch] $TerminalServerMode = $false,
[string] $Profile = $null
And here's the body of your script:
# Validate Profile parameter
If ($Profile -eq $null -or $Profile -eq "") { Show-DialogBox -Text "You must specify a valid profile using the -Profile parameter" -Icon "Stop"; Exit-Script -ExitCode 2 }

# Install common apps here
Execute-MSI -Action Install -Path "MyCommonApp.msi"

# Install Profile-specific applications
# Switch ($Profile) {
    "Accounting" { 
        # Install Accounting apps
        Execute-MSI -Action Install -Path "MyAccountingApp.msi"
    }
    "Finance" { 
        # Install Finance apps
        Execute-MSI -Action Install -Path "MyFinanceApp.msi"
    }
    "Marketing" { 
        # Install Marketing apps
        Execute-MSI -Action Install -Path "MyMarketingApp.msi"
    }
To execute, you'd run

Deploy-Application.exe -Profile "Marketing"

This would be a cleaner way, rather than creating a new parameter for each department. And there should be no limit to the number of different profile names you can use.

Hope this helps, Dan.