Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Use Powershell to create Application with specific Return Code handling (set 3010 to Success )

  • Thread starter Thread starter pede
  • Start date Start date
  • Replies Replies 1
  • Views Views 4K
P

pede

Guest
Hi,

i´m creating Applications via Powershell and i got nearly everything i need, except that for some Apps like Dell Server Admin i need to set a returncode from 3010 - Soft Reboot to Success (no reboot).
I manage Servers, no clients. I want to push it out controlled on a bunch of servers and the reboot can be done on the next Windows Patchday (to reduce number of reboots)
At some points it was caused by a vcredist integrated in the msi.
In order to get no reboot i want to force 3010 to success, which works via the GUI. But in terms of automating i was wondering if there is a way to set that property for this application(not generally for all)

Any Ideas?
1603800074273.png



Code:
$Name = "Dell EMC OpenManage Systems Management Software (64-Bit)-9.5"
$Description = "Windows Server 2012 R2, Windows Server 2019 LTSC, Windows Server 2016"
$Publisher = "Dell"
$SoftwareVersion = "9.5"
$IconLocationFile ="\\SERVERNAME\Sources$\Dell\ServerAdmin\OM.ico"
$MSIFile = "\\SERVERNAME\Sources$\Software\Dell\ServerAdmin\9.5\SysMgmtx64.msi"
$InstallCommand = 'msiexec /i "SysMgmtx64.msi" /l*v c:\windows\temp\Dell-SA.log /q /norestart TRANSFORMS=1033.mst REBOOT=REALLYSUPPRESS'

New-CMApplication -Name $Name -Description $Description -Publisher $Publisher -AutoInstall $true -SoftwareVersion $SoftwareVersion -IconLocationFile $IconLocationFile -DefaultLanguageId 1033

# Create MSI Deployment Type

#OS RULE     
$GC = Get-CMGlobalCondition -Name ”Operating System” | Where-Object PlatformType -eq 1
$OS1=Get-CMConfigurationPlatform "All Windows Server 2012 R2 (64-bit)"
$OS2=Get-CMConfigurationPlatform "All Windows Server 2016 (64-bit)"
$OS3=Get-CMConfigurationPlatform "All Windows Server 2019 and higher (64-bit)"
$Rule = $GC | New-CMRequirementRuleOperatingSystemValue -RuleOperator OneOf -Platform $OS1,$OS2,$OS3

Add-CMMsiDeploymentType -ApplicationName $Name -DeploymentTypeName "Install $Name" -ContentLocation $MSIFile -LogonRequirementType WhetherOrNotUserLoggedOn -InstallCommand $InstallCommand -RebootBehavior NoAction   -Force  -AddRequirement $Rule
 
Yes, this is possible.
Code:
$dt = Add-CMMsiDeploymentType -ApplicationName $Name -DeploymentTypeName "Install $Name" -ContentLocation $MSIFile -LogonRequirementType WhetherOrNotUserLoggedOn -InstallCommand $InstallCommand -RebootBehavior NoAction   -Force  -AddRequirement $Rule
Add-CMDeploymentTypeReturnCode -InputObject $dt -ReturnCode 3010 -Name "Suppressed Reboot" -CodeSype Success -Description "A reboot is required but this reboot will not be passed to ccmclient"

Here is the documentation.
 

Forum statistics

Threads
7,165
Messages
27,967
Members
18,270
Latest member
clickclick

Trending content

Back
Top