Run a specific command for each user

Comments

6 comments

  • Mike Kercher

    Would it be possible to create another package to be deployed after the MSI installation and have that second package run as the logged on user instead of the default deployment user?

    0
    Comment actions Permalink
  • Yannick A.

    Yes absolutely. But how can I tell, inside the package to use a command with variable 1 for computer 1, variable 2 for computer 2, etc?

    0
    Comment actions Permalink
  • Patrick H.

    Similar to Mike's suggestion, your best bet might be to run the step/package as logged on user, and call for environment variables, like the ones below:

    %USERNAME%
    %COMPUTERNAME%
    %HOMEPATH%

    This website has a comprehensive list of them, and from personal experience, I've used variables in Command Line or PowerShell steps without issue, though I've never tried using ones that depend on the logged in user. You may have to experiment a bit on this one.

    0
    Comment actions Permalink
  • Yannick A.

    To be more acurate, I have this command to run for each computer.

    3CXDesktopApp.exe tcx+app:HTTPS://IPADDRESS:5001/P/ID/[OTHER_ID]

     

    [OTHER_ID] is different for each computer, how can send this command, with the specific [OTHER_ID] each time?

    0
    Comment actions Permalink
  • Patrick H.

    Okay, I can see why you're getting stuck then.

    The best way to accomplish this then might be via a small PowerShell script that employs variables; set the variable in a prior line, maybe do some math or string modifiers to arrive there if it's based on one of the native computer or user variables, then call that variable in your actual command.

    I'm afraid my PowerShell coding skills are quite limited so I'm not exactly sure how to accomplish that myself, but there's plenty of good resources online, and if you have some programming skill, the PowerShell ISE coding environment native to Windows 10 might be enough to help you fill in the blanks. Hopefully this helps, and good luck!

    1
    Comment actions Permalink
  • Yannick A.

    Thank you Patrick H. This is helpful, I believe I can script something in powershell indeed, I just needed your great idea.

    Thanks again.

    0
    Comment actions Permalink

Please sign in to leave a comment.