protected override void ProcessRecord() { if (this.ParameterSetName == "PsDetectionMethod") { this.WriteVerbose("Creating deployment type using a PowerShell script as the detection method"); try { CMDeploymentType.AddScriptInstaller(this.ApplicationName, this.DeploymentName, this.PowershellDetectionScript, this.InstallCommand, this.UninstallCommand, (int)this.PostInstallBehaviour, (int)this.UserInteractMode, this.MaximumExecutionTimeInMinutes, this.EstimatedExecutionTimeInMinutes, (int)this.ExecutionContext, this.ComputerName); this.WriteVerbose("Added deployment type to application"); } catch (Exception ex) { this.WriteError(new ErrorRecord(ex, "", ErrorCategory.WriteError, this)); } } if (this.ParameterSetName == "HklmDetectionMethod") { this.WriteVerbose("Creating deployment type using a HKLM registry key as the detection method"); try { CMDeploymentType.AddScriptInstaller(this.ApplicationName, this.DeploymentName, this.KeyPath, this.Is64Bit.ToBool(), this.ValueName, this.Value, this.ValueDataType, this.Expression, this.InstallCommand, this.UninstallCommand, (int)this.PostInstallBehaviour, (int)this.UserInteractMode, this.MaximumExecutionTimeInMinutes, this.EstimatedExecutionTimeInMinutes, (int)this.ExecutionContext, this.ComputerName); this.WriteVerbose("Added deployment type to application"); } catch (Exception ex) { this.WriteError(new ErrorRecord(ex, "", ErrorCategory.WriteError, this)); } } }
protected override void ProcessRecord() { if (this.ParameterSetName == "RegistryRequirement") { try { CMDeploymentType.AddRequirement(this.ApplicationName, this.AuthoringScopeId, this.LogicalName, this.SettingLogicalName, this.Value, this.ValueDataType, this.Expression, this.ComputerName); this.WriteVerbose("Updated application with registry requirement information"); } catch (Exception ex) { this.WriteError(new ErrorRecord(ex, "", ErrorCategory.WriteError, this)); } } if (this.ParameterSetName == "OsRequirement") { try { CMDeploymentType.AddRequirement(this.ApplicationName, this.OperatingSystem, this.ComputerName); this.WriteVerbose("Updated application with OS requirement information"); } catch (Exception ex) { this.WriteError(new ErrorRecord(ex, "", ErrorCategory.WriteError, this)); } } }
protected override void ProcessRecord() { try { CMDeploymentType.AddSupersedence(this.ApplicationName, this.SupersededApplicationName, this.Uninstall.ToBool(), this.ComputerName); this.WriteVerbose("Updated application with superseded application information"); } catch (Exception ex) { this.WriteError(new ErrorRecord(ex, "", ErrorCategory.WriteError, this)); } }