SCCM 2012 application run Powershell script and return codes

Hi,
I created an new application (imported as MSI) in SCCM 2012R2. After import I changed the deployment type installation program to run a Powershell script: powershell.exe -ExecutionPolicy Unrestricted -File "Install FactSet 2013 5I.ps1
My goal is to close some processes before installing the MSI. This works. But on a failure the application program also return code 0 (AppEnforce.log). Is it possible to pass the MSI return codes to SCCM.
Maybe anyone had the same or idea's to solve this? Thanks in advance.
Regards,
Peter
Powershell script code:
$ExitCode=0
Function
Stop-RunningApplication{
Param(
[parameter(Mandatory
=$true)]
[string]$ProcessName#
Specify process names separated by commas
# Split multiple processes on a comma and join with the regex operator '|' to perform "or" match against
multiple applications
$processName=$processName-split(",")
-join("|")
$process=Get-Process|Where{
$_.ProcessName
-match$processName}
|Stop-Process-Force
#Stop running processes
Stop-RunningApplication
-ProcessName"excel,outlook,fdsw32,marquee,POWERPNT,WINWORD"
#Install FactSet 2013 5I
$ExitCode
=(Start-Process".\FactSet_Setup_2013_5I_x644.msi"'/qn
FACTSET_CLOSE_PROCESSES=1 /l*v C:\Temp\InstFac20135I.log'-Wait-Passthru).ExitCode
Environment]::Exit($ExitCode)
Peter vd Bosch

It's really hard to tell from the code above because of the way it's listed, but are sure that even executes? I see at least one stray curly brace and a stray square bracket.
For the Start-Process cmdlet, have you tried without the -passthru parameter?
Also, using the actual parameters will make the code much more readable instead of relying on position.
Jason | http://blog.configmgrftw.com | @jasonsandys

Similar Messages

  • Orchestrator and SCCM 2012 integration: run task sequence and install assigned applications/packages?

    Dear,
    We do not have Orchestrator running in our SCCM 2012 R2 environment. Though I wonder if we could accomplish the following scenario with it:
    Task sequence Windows 7 => Orchestrator step which queries assigned installations to the computer object and installs them one by one.
    Could you advise?
    Kind regards,
    Stev.
    SteveWonB

    > > Define "assigned to computer objects". How is this done technically?
    Well, computer objects are members of collections via AD memberships, like the collection "W7-Google-Chrome" (exists of 100 computer objects).
    Deploy of packages is done to these collections. So a computer member of  "W7-Google-Chrome"  will automatically get Google Chrome.
    Some computers are member of 30 collections, some of 80.
    Goal is to have the task sequence run all applications/packages assigned (with their reboots if needed).
    Kind regards,
    Steven
    SteveWonB

  • Passing parameters with spaces to SCCM Run PowerShell Script task

    I am working on an OS deployment task sequence in SCCM 2012 R2 with several Run PowerShell Script tasks.  Most of them run fine, but I am having trouble with the one I need to pass parameters to.
    The parameters I need to pass are:
    -ComputerOU "ou=All Workstations,dc=contoso,dc=com" -GroupDN "cn=Group1,ou=All Groups,dc=contoso,dc=com"
    I have that line (with actual DNs) entered in Parameters of the task.
    But when the script runs on the target machine, the values of the parameters in the script are truncated at the spaces.  $ComputerOU is set to "ou=All" and $GroupDN is set to "cn=Group1,ou=all"
    What syntax should I be using the Parameters field of the Task in order to properly pass PowerShell parameter string values that include spaces?
    Tim Curwick
    MadWithPowerShell.com

    Thank you, TC, but I am not calling the parameters from within PowerShell.
    The parameters are in the settings of a task sequence task to be used by the task to launch a script.  The syntax I am using would be correct for use within PowerShell or from a command line or batch script, but SCCM appears to be doing some parsing
    before or while it is passing them to the script, possibly dropping the quotes which causes mishandling of the spaces in the string values.
    Historically, it is always challenging to give one application parameters to pass to another application, and the required syntax can get quite tricky when the two application handle quotes or spaces differently, or when the parent application wants to parse
    something intended to be passed on as is to the child application.
    I'm sure someone has already figured out what the syntax needs to be for doing this with an SCCM 'Run PowerShell Script" task, it's just one of those issues that is hard to Google effectively.
    Any other ideas?
    Tim Curwick
    MadWithPowerShell.com

  • OSD - Task Sequence to run powershell script

    Hello,
    I'm building up an image with OSD and will be layering some components to meet our needs with some powershell scripts. At the moment we will not have this device add itself to the domain so it'll be in a workgroup. The scripts are on a share that everyone has
    read access to. Should I add a task sequence that will map a drive letter with domain credentials and have the task sequence call the script from that drive letter?

    That is possible to do, but why would you not create a package/application with the script and let it download and run locally? 
    Daniel Ratliff | http://www.PotentEngineer.com

  • SCCM 2012 application portal: config questions

    Hi,
    We have setup SCCM 2012 application portal correctly and it's working fine.
    However some config questions:
    -can we change the name of the configuration portal? Now its servername/CMApplicationCatalog ... what's not userfriendly.
    We'd like it to be applicationportal.ourcompany.com. Howto achieve that?
    -can we customize layout in a supported way (we could change html pages but after an upgrade of SCCM they would/could be erased)?
    -how does flexera (adminstudio?) plugs in into this. I've read this entry
    http://helpnet.installshield.com/appportal2014/Content/helplibrary/AP_CreatingCatItemSCCM.htm but what's the big picture here? Anybody using this? What are the advantages?
    J.
    Jan Hoedt

    We want to offer software center for overview of mandatory installs, application catalog for optional software.
    On our companies portal, we can then set a link which directs to the application portal. User can then install optional software from there.
    My current config works http://applicationportal.ourcompany.com/ goes to the sccm-server but not to the url below.
    That would be http://applicationportal.ourcompany.com/CMApplicationCatalog/#/SoftwareLibrary/AppListPageView.xaml
    how can I make sure the application portal shows up when this link is opened?
    It sounds like you want to perform a URL rewrite?
    http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
    You should test this to see if it's what you want - I may have misunderstood your question.
    Also, I wouldn't host this module on your AppCatalog server, I'd host the rewrite module elsewhere.
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • Are there any command line utilities(@client machine)/APIs to initate software installtion from SCCM 2012 application catalog?

    I'm searching for any utilities / APIs available for SCCM 2012 Application catalog, to initiate a Application installation from a Script(From client machine). Got to know there Client programming is possible, but not able to get good examples. Please help
    Regards, Eswar

    Hi,
    Hope the following sample could help you.
    Sample SCCM Application
    Best Regards,
    Joyce Li
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Issue with running powershell script in pssessions

    Hi Everyone,
    I am trying to run powershell script from remote machine using below commands
    C:\Users\user>"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
    -command "$s= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
    http://Exchservername/PowerShell/ -Authentication Kerberos ; Import-PSsession $s; "C:\Failback.ps1"
    and Below is the failback.ps1.
    $mbxs = Get-MailboxDatabase | Sort Name
    ForEach($mbx in $mbxs)
    $MBdb=$mbx.Name $ServerHosting=$mbx.Server.Name
    if($mbx.activationPreference.value -eq 1)
    If ($ServerHosting -ne $ActivationPreference.Key.Name) 
    Move-ActiveMailboxDatabase $MBdb -ActivateOnServer $ActivationPreference.Key.Name -confirm:$False 
    Below is what i am getting.

    What is your question?  Are you pointing out the yellow text?  This is normal, and appears every time EMS is opened.
    I should also point out that Microsoft provides a script to re-balance databases, if that's what you're trying to accomplish:
    You can use the RedistributeActiveDatabases.ps1 script to balance the active mailbox databases copies across a DAG. This script moves databases between their copies in an attempt to have an equal number of mounted databases on each server in DAG. If required,
    the script also attempts to balance active databases across sites.
    https://technet.microsoft.com/en-us/library/dd335158(v=exchg.141).aspx
    Mike Crowley | MVP
    My Blog --
    Baseline Technologies

  • Can servlets/ jsp automatically run perl scripts and executables?

    I'm a student and am new to to servlets and web programming in general.
    I need to know if it's possible to run perl scripts and executables automatically from servlets/ jsp.
    The program I am planning on creating should have a client outside a firewall that uploads perl files to a gateway machine inside the firewall, the servlet should be able to run this perl file, and then pass the resulting file as an argument to an executable, to be run by another servlet on a different server.
    I've tried looking everwhere for an answer to this and am about to revert to a cgi based approach because I'm not sure if it would work so any help/ suggestions would be much appreciated.

    Hallo,
    I think using java Runtime will help. you can do Processes that execute shell or system commands through
    Process process = Runtime.getRuntime().exec("your perl scripts here!");
    Bye

  • Install Acrobat 7 and CS2 applications - running Windows 2000 and IE 6

    need to install replacment Acrobat 7 and CS2 applications - running Windows 2000 and IE 6. Any problems with this?

    http://web.archive.org/web/20070203090721/http://www.adobe.com/products/creativesuite/syst emreqs.html

  • Run Powershell Script task sequence

    Hi,
    Anyone have good documentation on how to use the Run PowerShell Script task sequence ?
    Thanks

    If you are just interested in running a powershell command without creating a package, you can do this with the the Command line step by using this format in the command line:
    PowerShell -ExecutionPolicy bypass -Command "& {your powershell commands}"
    Here is an example of a multiline command to increase the agents cache size. Notice the ";"'s which are used to delineate a new line.
    PowerShell -ExecutionPolicy bypass -Command "& {$UIResourceM gr = New-Object -ComObject UIResource.UIResourceMgr;$Cache = $UIResourceMgr.GetC acheInfo();$Cache.TotalSize = "20480"}"

  • Running "nightly scripts" and other behind the scenes tasks

    I keep seeing posts about how the iMac Intel runs nightly scripts and/or other tasks behind the scenes. There is no mention of this in the user manual nor does Apple warn you about not putting the computer to sleep so that these tools will run. My iMac hard drive is asleep every night (as am I...) how can I get these things to run manually? How often? And can someone point me to literature to support this info?
    Thanks much,
    HS

    522/2968
    Hi HS,
    "There is no mention of this in the user manual"
    That's because the three nightly maintenance scripts are not important at all, and don't affect Mac OS X performance.
    They are only a relic from the glorious Unix system times when it was used on rather small capacities HDs, on computers that were running non stop for months or years...
    Running them yourself manually, as a "perfectionist measure", can be done easily using the "daily, weekly & monthly" features in OnyX or Cocktail for example. All three tasks together, once a month or so, is fine. No harm (but useless) rerunning them many times.
    Litterature:
    The KB article is quite old, it shows only the default 10.2 times and commands:
    - http://docs.info.apple.com/article.html?artnum=107388
    (almost same as 10.3 and 10.4 though)
    What I really would like to learn, is whether the scripts have been modified in the Intel version of Tiger.
    Could you please (or Joseph or somebody else), in Finder, Go To (shiftcommandG) this folder:
    /private/etc/
    see if there is still the same
    /private/etc/periodic
    folder, with the three
    /private/etc/periodic/daily
    /private/etc/periodic/weekly
    and
    /private/etc/periodic/monthly
    scripts?
    (I'm asking because I don't own an Intel Mac myself).
    Next you would Go To (⇧⌘G) this folder:
    /System/Library/LaunchDaemons
    please, see if you find those three files
    /System/Library/LaunchDaemons/com.apple.periodic-daily.plist
    /System/Library/LaunchDaemons/com.apple.periodic-weekly.plist
    and
    /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist
    If they are still there, you can open them (with TextEdit if your Developer Tools are not installed), and read the default times when the tasks are scheduled to run.
    Thanks in advance!
    Axl

  • /SAPAPO/OM102 and return code 40.050

    Hi Experts,
    Please help me regarding the error message in interactive demand planning screen Error for COM routine using application program message "/SAPAPO/OM102 and return code 40.050 "
    Thanks
    Sree

    Hi Sree,
    You can check out the details of OM102 error messages in transaction /SAPAPO/OM10 by specifying the return code.
    For your error the detailed message says:
    Relation does not exist
    Message no. /SAPAPO/OM_TS050
    Diagnosis
    A function module was opened with a relation that does not exist in liveCache.
    Procedure
    Open an SAP Support message as described in SAP Note 167280.
    I suggest you do as the message suggests and open an OSS message for it. It doesn't seem like an error you can resolve with a simple consistency check run.

  • CHECK OF UPDATE TASK Errors and RETURN CODE in RSVBCHCK.MX1

    hi ia m getting this error during the upgrade .i did checked in sm12 for any failed updates but there arent any .so i think there should be a table that i need to alter.should this be done in se16 ? and i think the table name is TRAN.LBWG any ideas.
    CHECK OF UPDATE TASK Errors and RETURN CODE in RSVBCHCK.MX1
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    A2EEMCEX 141 Struct. appl. "02" cannot be changed due to setup table -> Long tex
      Long text:
        Cause
          Changing the extract structure &V#& for application &V#& is not
          permitted, because the restructure table &V#& for the extractor still
          contains data in &V#&.
          You cannot change the structure in this status, because when you load
          an InfoPackage from BW, this leads to errors.
        What to do
          <DS:TRAN.LBWG>Delete</> the entries for all restructure tables for
          application &V#&.
    1 ETH010XRSVBCHCK: Check of open update requests
    A2EEMCEX 141 Struct. appl. "02" cannot be changed due to setup table -> Long tex
    t" ""MC02M_0HDRSETUP""100"
    A2EEMCEX 141 Struct. appl. "02" cannot be changed due to setup table -> Long tex
    t" ""MC02M_0ITMSETUP""100"
    A2EEMCEX 141 Struct. appl. "02" cannot be changed due to setup table -> Long tex
    t" ""MC02M_0SCLSETUP""100"
    A2EEMCEX 141 Struct. appl. "03" cannot be changed due to setup table -> Long tex
    t" ""MC03BF0SETUP""100"
    A2EEMCEX 141 Struct. appl. "03" cannot be changed due to setup table -> Long tex
    t" ""MC03BX0SETUP""100"
    A2EEMCEX 141 Struct. appl. "03" cannot be changed due to setup table -> Long tex
    t" ""MC03UM0SETUP""100"
    A2EEMCEX 141 Struct. appl. "11" cannot be changed due to setup table -> Long tex
    t" ""MC11VA0HDRSETUP""100"
    A2EEMCEX 141 Struct. appl. "11" cannot be changed due to setup table -> Long tex
    t" ""MC11VA0ITMSETUP""100"
    A2EEMCEX 141 Struct. appl. "11" cannot be changed due to setup table -> Long tex
    t" ""MC11VA0STHSETUP""100"
    A2EEMCEX 141 Struct. appl. "11" cannot be changed due to setup table -> Long tex
    t" ""MC11V_0SSLSETUP""100"
    A2EEMCEX 141 Struct. appl. "13" cannot be changed due to setup table -> Long tex
    t" ""MC13VD0ITMSETUP""100"
    4 EPU202XEND OF SECTION BEING ANALYZED

    1. Call transaction SMQ1 and check whether all queues in all clients (client = '', queue name 'MCEX') have been processed. To process the queues, start the collective run report for each application in the displayed clients. If you no longer need the data in the BW system, deactivate the relevant extraction queues and DataSource in the LO cockpit (transaction LBWE) and delete the queue entries in transaction SMQ1.
    2. If you use the V3 update that is not serialized (usually only for application 03): Start collective run report RMBWV303. Then check the update orders in transaction SM13. If there are incorrect update orders in transaction SM13, correct the orders and then start the collective run report again. If you no longer require the update orders, you can delete them. There may be inconsistencies between tables VBMOD and VBHDR. For further information about this, see Notes 652310 and 67014.
    3. Before the upgrade, delete the contents of the setup tables. Execute report RMCEX_SETUP_ENTRIES to find out which setup tables still contain entries. You can use transaction LBWG to delete the contents of the setup tables for all clients.
    Unfortunately the check that the system carries out during the upgrade or when you import a Support Package does not display all affected applications. Therefore, Note 1083709 provides a check report that you can use to determine all affected applications and tables or queues.

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Running msiexec failed with return code 1619: While running SOFTWARE PROVISIONING MGR 1.0

    Hello All SAP Basis Guys,
    Running msiexec failed with return code 1619: getting this error
    While running SOFTWARE PROVISIONING MGR 1.0 (for Windows Server on IA32 32bit ) for renaming (Domain name change) the SAP ECC 6.0 server on top of Windows Server 2003 x86 which is a 32 bit OS.
    I am using the SAPCAR (for Windows Server on IA32 32bit ) to extract .SAR
    can anyone please help me with this ?
    List of attached for your reference.
    1. Available versions of SPWM for windows in marketplace.
    2. Window version details of KC1GSCSAP6 server (GS1 system).
    3. Error screen while running SWPM
    Thanks,
    John

    Issue has been resolved, its a bug in SWPM tool.
    Problem:
    SAPCAR is extrating the "sapmmcx86u.msi" under the folder DBINDEP.
    But while running the tool, system is trying to open "sapmmcx86u.msi" from the path "common\install" folder.
    Solution:
    After you received the error, copy path "sapmmcx86u.msi" to "common\install" folder and you will be good.

Maybe you are looking for