Last active
October 4, 2017 06:05
-
-
Save melvinlee/477c5c00182d8f5e1c4ccb45d7321ae4 to your computer and use it in GitHub Desktop.
CodeDeploy Poweshell Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CodeDeploy powershell template | |
# Are you running in 32-bit mode? | |
# (\SysWOW64\ = 32-bit mode) | |
if ($PSHOME -like "*SysWOW64*") | |
{ | |
Write-Warning "Restarting this script under 64-bit Windows PowerShell." | |
# Restart this script under 64-bit Windows PowerShell. | |
# (\SysNative\ redirects to \System32\ for 64-bit mode) | |
& (Join-Path ($PSHOME -replace "SysWOW64", "SysNative") powershell.exe) -File ` | |
(Join-Path $PSScriptRoot $MyInvocation.MyCommand) @args | |
# Exit 32-bit script. | |
Exit $LastExitCode | |
} | |
$transcript = "C:\ProgramData\Amazon\CodeDeploy\$Env:DEPLOYMENT_GROUP_ID\$Env:DEPLOYMENT_ID\Stop-CmsWindowsServices.ps1.txt" | |
Start-Transcript $transcript | |
# Was restart successful? | |
Write-Warning "Hello from $PSHOME" | |
Write-Warning " (\SysWOW64\ = 32-bit mode, \System32\ = 64-bit mode)" | |
Write-Warning "Original arguments (if any): $args" | |
# Custom code start here | |
# Custom code end here | |
exit $LastExitCode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment