-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommand.ps1
52 lines (40 loc) · 1.66 KB
/
command.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#Generic function to gracefully exit dRMM PowerShell script
#@param exitcode: mandatory, code to exit with; 0=success, 1=failure
#@param results: string or integer to pass back to dRMM for results of script
#@param diagnostics: additional information to pass back to dRMM for results of script
function Exit-dRMMScript {
[cmdletbinding()]
Param([Parameter(Mandatory=$true)]$exitcode, $results, $diagnostics)
#Output results
Write-Output "<-Start Result->"
Write-Output "Result=$results"
Write-Output "<-End Result->"
#Output diagnostics, if they exist
if (!($null -eq $diagnostics)) {
Write-Output "<-Start Diagnostics->"
Write-Output "Result=$diagnostics"
Write-Output "<-End Result->"
}
exit $exitcode
} #End function
#Generic function to set dRMM UDF
#@param udf_number: mandatory, UDF number to set
#@param udf_value: mandatory, value to set UDF to
function Set-dRMM-UDF {
Param([Parameter(Mandatory=$true)]$udf_number, $udf_value)
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\CentraStage /v "Custom$udf_number" /t REG_SZ /d "$udf_value" /f
}
#Dump all the environmental variables to stdout, usually only for debugging
if ($env:drmm_dump_env_vars -eq "true") {
Get-ChildItem variable:$env | ForEach-Object {
Write-Output $_
}
}
Set-Variable -Name EXIT_SUCCESS -Value 0 -Option Constant
Set-Variable -Name EXIT_FAILURE -Value 1 -Option Constant
########################################
##### Begin custom script section ######
########################################
# Do things
Write-Output $hello_world_var
Exit-dRMMScript -exitcode $EXIT_SUCCESS -results "Success!" -diagnostics "Additional info here"