I am in the process of deploying WinSQL via SCCM 2012 on Win 7 machines.  I've put together a Batch file (script below) to get this all going, but have hit a bit of a wall.  The program needs to launch in order it to create the folder where the serial information\file is stored.  I am attempting to have the batch file install, launch, close and then write to the configuration file.  The program installs, however, it does not launch afterward.  Software Center shows INSTALLED, but the script never accomplishes what I need it to.

Please keep in mind, if I run it locally everything works perfectly.  It's just that when it is executed via SCCM, it's not launching, closing, writing to the config file.

Thoughts? 



msiexec.exe /i "WinSQL.msi" /qn
timeout /t 15 /nobreak
start /d "%PROGRAMFILES(X86)%\synametrics technologies\winsql\" winsql.exe
timeout /t 10 /nobreak
taskkill /IM Winsql.exe
timeout /t 5 /nobreak
@echo off
@echo OwnerName=ABCD >> %userprofile%\AppData\Roaming\WinSQL\WinSQL.conf  
@echo CoName=ABC >> %userprofile%\AppData\Roaming\WinSQL\WinSQL.conf
@echo SerialNum=123456789 >> %userprofile%\AppData\Roaming\WinSQL\WinSQL.conf
Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

2

The install will be running in the system context, and therefore won't be able to perform the other actions in the batch file that you want to run in the user context.

Assuming you have a site licence, and every user of the target machine will have access to it then there are a few ways to approach this. All of these would remove the need to launch the application first as you'd create the folder structure as part of the process.

The 'pure' MSI packaging approach would be to use an customisation file with the MSI (MST) to include the file with the package (either in the INIFILE table or as a flat file) and use ActiveSetup to populate this for all users.

Running the MSI from a batch file means that you lose some of the functionality of SCCM with regard to the handling of MSI files.

Other methods to consider are:

-Per-User SCCM package to populate the file

-Login script that uses 'if not exist' then copy to populate the file

-Script utilised by ActiveSetup to populate the file.


Hope that gives you a few pointers,


Dunnpy


Answered 08/03/2016 by: dunnpy
Red Belt

  • This provides a good direction to where I ultimately will end up. Something tells me I will just create the MST for this particular setup.

    Thank you!
  • The methods I've tried have not worked via SCCM.

    Below is my current batch script just for the Folder and file creation. I've tried this a few different ways but keep falling short. I tried to change the current working directory via
    cd\
    cd users

    ...but that didn't work. I also tried the MST method, and that did not work. At this point I think I'm burning myself out.

    Thoughts?

    (Current batch file)

    md %userprofile%\AppData\Roaming\WinSQL
    copy "WinSQL.conf" %userprofile%\AppData\Roaming\WinSQL\
    • This batch would need to be run in the user context, and run for each user logging on that needs to use the application - and only when a user is logged on.

      Have you verified that manually creating the directory structure and dropping in the file achieves the desired result when running the MSI from SCCM?
      • Yes, manually creating the directory structure and copying the .Config before running the .MSI works. It actually adds files to the folder and amends the .Config keeping the information I need after you launch the program for the first time.

        It's just creating the directory structure and copying the file through SCCM that's causing the issue. I tried changing the working directory, but it just doesn't do what I need it to.
Please log in to comment

Answers

0
FYI, I got it to work doing the following.

Instead of creating a Package it had to be done as an Application, set to install for user. 

I used a powershell script to create the folder and copy the file over.  I created an Application for that, and daisy chained it.

I also used an IF\Else powershell statement to do the detection method.

The user still has to open and close WinSQL for it to register the serial, but it works.

Thank you for pointing me in the right direction.
Answered 08/30/2016 by: DaBXRoMeO
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share