Skip to content

Instantly share code, notes, and snippets.

cd "C:\Program Files (x86)\CPM Agent\scripts\cpm_user_id\"
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{set-executionpolicy unrestricted}"
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{.\startservices.ps1; exit $LastExitCode}"
@echo From Cmd.exe: startservices.ps1 exited with exit code %errorlevel%
Try{
# Starts Services
Start-Service RepositoryDatabase -ea Stop
Start-Service RepositoryService -ea Stop
Start-Service EngineService -ea Stop
Start-Service PrintingService -ea Stop
Start-Service SchedulerService -ea Stop
Start-Service ServiceDispatcher -ea Stop
Start-Service asProxyService -ea Stop
}
cd "C:\Program Files (x86)\CPM Agent\scripts\cpm_user_id\"
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{set-executionpolicy unrestricted}"
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{.\CPM_start_services.ps1; exit $LastExitCode}"
@echo From Cmd.exe: startservices.ps1 exited with exit code %errorlevel%
@newlyregistered26
newlyregistered26 / aws_elbv2_create.txt
Last active November 22, 2016 05:43
aws_elbv2_create
#Creates the target group, note the target group ARN as we'll need it several times.
aws elbv2 create-target-group --name sometargetgroup --protocol HTTPS --port 443 --vpc-id vpc-123456
#Creates the Load Balancer - This takes some time to provision the load balancer, during this time it will in state provisioning, note the ALB ARN, as we'll need it later
#Create a security group to associate with the ELB
aws elbv2 create-load-balancer --name someALBname --subnets subnet-12345456 subnet-6543263--scheme internal --security-groups sg-12345456
#Create the listener and associate the certificate registered
aws elbv2 create-listener --load-balancer-arn arn:aws:elasticloadbalancing:ap-southeast-2:someaccountno:loadbalancer/app/someALBname/75422c5724af4c03 --protocol HTTPS --port 443 --certificates CertificateArn=arn:aws:iam::someaccountno:server-certificate/site.example.com --ssl-policy ELBSecurityPolicy-2015-05 --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:ap-southeast-2:someaccount
@newlyregistered26
newlyregistered26 / gist:1f4128e16116d08620ad308f3760d7c0
Created November 22, 2016 05:06
aws-elbv2-create-target-group
aws elbv2 create-target-group --name targetgroup --protocol HTTPS --port 443 --vpc-id vpc-123456
{
"TargetGroups": [
{
"HealthCheckPath": "/",
"HealthCheckIntervalSeconds": 30,
"VpcId": "vpc-123456",
"Protocol": "HTTPS",
"HealthCheckTimeoutSeconds": 5,
"HealthCheckProtocol": "HTTPS",
"UnhealthyThresholdCount": 2,
{
"TargetGroups": [
{
"HealthCheckPath": "/",
"HealthCheckIntervalSeconds": 30,
"VpcId": "vpc-123456",
"Protocol": "HTTPS",
"HealthCheckTimeoutSeconds": 5,
"HealthCheckProtocol": "HTTPS",
"UnhealthyThresholdCount": 2,
-----BEGIN CERTIFICATE-----
MIIFWTCCBEGgAwIBAgIKaSk9ZwAAAAAABDANBgkqhkiG9w0BAQUFADBuMRIwEAYK
CZImiZPyLGQBGRYCYXUxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/Is
ZAEZFgZxYW50YXMxEjAQBgoJkiaJk/IsZAEZFgJxZjEXMBUGA1UEAxMOUUFOVEFT
IFJvb3QgQ0EwHhcNMTAwNjI1MDY0MjM0WhcNMjAwNjI1MDY1MjM0WjBzMRIwEAYK
CZImiZPyLGQBGRYCYXUxEzARBgoJkiaJk/IsZAEZFgNjb20xFjAUBgoJkiaJk/Is
ZAEZFgZxYW50YXMxEjAQBgoJkiaJk/IsZAEZFgJxZjEcMBoGA1UEAxMTUUFOVEFT
IElzc3VpbmcgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM4j
izU+HZbXWUbUrLq5Q76PQOvgOkLZf6x8d8YskIdwg8utHZC5sIXfylvT/TsdFeAb
1OyS5Gf0Xm6cvaYnhont+g4xEF/tct+Ff36LoWWegdq7kn+tVD4Vu6LEgP4DvB+E
aws iam upload-server-certificate --server-certificate-name service.example.com --certificate-body file://SomePublic.cert --private-key file://SomePrivateKey.key --certificate-chain file://thawte_trust_chain.txt
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted