Dan

Dan

Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • Dan
    Participant
    Post count: 13

    So, I’ve got the script to exit with 3010, but it’s still not passing it to SCCM

    Here is my installation program line: PowerShell.exe -Executionpolicy bypass .\Deploy-Application.ps1 -DeploymentType “Install” -DeployMode “Silent” -AllowRebootPassThru

    The exit line in the log is:
    [Post-Installation] :: A restart has been flagged as required.
    [Post-Installation] :: NetMotionWireless,Inc._NetMotionMobilityClient_11.04.22344_x64_EN_01 Installation completed with exit code [3010].

    But I get a failed error in Software Center of 0x1(1). The application installed fine. When I restart, the detection method kicks in and the app shows installed.

    My guess is it is not passing the 3010 exit code to SCCM, thus prompting for a restart, thus completing the installation.

    Any more thoughts?

  • Dan
    Participant
    Post count: 13

    I asked the same question on Reddit. Here is the answer I got. (Thank you reddit user work-work-work-work)

    Check how [Switch] works as a parameter

    It has one Property “IsPresent” which is a bool.

    By specifying the parameter itself it switches to True, as the parameter was present. (Mostly. The Switch should default to False without having to specify it explicitly)
    TypeName: System.Management.Automation.SwitchParameter

    Name MemberType Definition
    —- ———- ———-
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetType Method type GetType()
    ToBool Method bool ToBool()
    ToString Method string ToString()
    IsPresent Property bool IsPresent {get;}

    Dirty example:
    param(
    [Parameter()]
    [Switch]$Interactive = $false

    )

    If($Interactive){write-host “woo”}

    Output:
    PS C:\temp> .\switchtest.ps1
    PS C:\temp> .\switchtest.ps1 -Interactive
    woo
    PS C:\temp>

  • Dan
    Participant
    Post count: 13

    Will that passthru to SCCM though?

  • Dan
    Participant
    Post count: 13

    All, I found a work around. To recap, when running the script from an SCCM application, Execute-MSI -Action ‘Uninstall’ -Path ‘{GUID}’ was returning an error saying the app was not installed (it was). I also tried Remove-MSIAPplications -Name ‘AppName’ and it returned the same error saying it was not installed (it was).

    When manually running this same script from an elevated command prompt using deploy-application.exe -DeploymentType Uninstall, the script would uninstall perfectly fine.

    I tried Execute-Process -Path ‘msiexec.exe’ -Parameters ‘/x {GUID} /qn /norestart’ from the SCCM application and it worked.

  • Dan
    Participant
    Post count: 13

    Great script! I’ve been going nuts with trying to do it the microsoft way. Keep getting stupid errors.
    Anyway, how are you triggering the “ifshared” switch?

    Also, have you come up with any switches to add to this script to add additional apps such as Visio and Project? We are installing the base software (minus groove/onedrive and access) but would like to utilize this script to add visio or project with a switch.

    Thoughts?

  • Dan
    Participant
    Post count: 13

    I think I figured it out. I need to enter the decimal equivalent, not the Hex into the line.

  • Dan
    Participant
    Post count: 13

    I think I figured it out. I need to enter the decimal equivalent, not the Hex into the line.

  • Dan
    Participant
    Post count: 13

    Never mind, I figured it out.

    Execute-Process -Path ‘$dirSupportFiles\ReportViewer.exe’ -Parameters ‘/q’

    should be double quotes
    Execute-Process -Path “$dirSupportFiles\ReportViewer.exe” -Parameters ‘/q’

  • Dan
    Participant
    Post count: 13

    (sorry posted this in the wrong section, deleting.)

    • This reply was modified 2 years, 5 months ago by  Dan.
Viewing 9 posts - 1 through 9 (of 9 total)