Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Passing Installation Version to PowerShell on Autodeployment

Hello,

I have created an autodeployment for iTunes.  I am also using PSADT to give deferral options (not to do the actually install), and would like to use PowerShell on the computer to reset the deferral remaining count on each new version that is released.  Additionally, it would be good to check that the version isn't already installed.  I'd like to do this version check on the PC because my fear is that PDQ Inventory may get updated with the new version number before the autodeployment package has the new version approved.  I don't want to bug the users if I don't have to.

A great solution to these two problems would be if there is a way that I could pass the version of iTunes (or other programs) that the auto-deploy is about to install.  I can't hard code this, since it changes each time.  Is there any way to do this?

Thanks

0

Comments

3 comments
Date Votes
  • Well...You could grab the current version of the auto deploy package from the Deploy database, unless there is a predefined variable already for it (I'd have to read the docs to be sure).

     

    That said you could add a Pre-Step to your Autodeployment that does all your checking with Powershell for version and deferral counts, and based on the output logic, do the install of iTunes. You could then do a post-script after iTunes has been installed to reset that deferral counter. 

    I hope I'm following you correctly and that all makes sense. Also note, when you go to look for the version of iTunes that is installed, use the registry and not WMI. WMI calls for installed programs rape your application logs and run a reconfigure operation on every installed piece of software on a machine. 

    Let us know if you need any help. I imagine it would be best to write the check data from your pre-steps to the registry, and then use registry conditions on the actual iTunes install to actually install/not install the software to a computer.

    Post step you can clean out those registry keys. 

    0
  • Stephen,

    Thanks for your suggestions.  Yes, you understood my question and I am following you... mostly.  What I'm struggling with is how do I "grab the current version of the auto deploy package from the Deploy database..."?  Do you mean I need to make a SQL connection to the database and run a query for that?

    Thanks again!

    -Sean

    0
  • Yes. You'd make a connection to the SQLite3 database and execute a query. I'm not a SQL guy by any stretch, and don't have my deploy console here at home with me. But I'll see if I can grab the version of an auto deploy package and post up the code. Basically it'll look like this:

     

    $db = '$env:ProgramData\Admin Arsenal\PDQ Deploy\Deploy.db'

    $sql = "SELECT Version FROM AutoDeployPackages WHERE AutoDeployPackages.Name LIKE 'iTunes';

    $query = Invoke-Command -Computername <pdqserver> -Scriptblock { $sql | sqlite3.exe $db }

    ##Do something with the value of $query 
    0