Skip to content

Instantly share code, notes, and snippets.

View dfrankel33's full-sized avatar

Dave Frankel dfrankel33

View GitHub Profile
$list = @"
1 Partridge in a pear tree
2 Turtle Doves
3 French Hens
4 Calling Birds
5 Golden Rings
6 Geese a laying
7 Swans a swimming
8 Maids a milking
9 Ladies dancing
#set servername variable
#$servername = read-host "Input server name"
$servernames = @("host1","host2","host3")
foreach ($servername in $servernames){
$server = rsc --refreshToken="abcd...wxyz" --host="us-3.rightscale.com" cm15 index /api/servers "filter[]=name==$servername"
$instancehref = (($server | ConvertFrom-Json).links | where rel -eq "current_instance").href
#start instance command:
rsc --refreshToken="abcd...wxyz" cm15 start $instancehref --host="us-3.rightscale.com"
#INPUTS
#$ENV:SCOM_MGMT_SERVER = IP Address or FQDN of SCOM Management Server
#$ENV:SCOM_MGMT_GROUP = SCOM Management Group, if NULL, attempt to determine via registry
#$ENV:SCOM_USERNAME = User that has access to connect remotely to SCOM Management Server and has access to delete managed computers
#$ENV:SCOM_PASSWORD = Password for above user
#Set Error Action Preference
$errorActionPreference = "Stop"
#RightLink/RSC Working Directory
$AD_Domain = $ENV:AD_DOMAIN_NAME
$AD_NetBios = $ENV:AD_NETBIOS_NAME
$AD_OU = $ENV:AD_OU_NAME
$AD_Password = $ENV:AD_ADMIN_PASSWORD
$AD_User = $ENV:AD_ADMIN_USERNAME
$AD_New_Name = $ENV:AD_NEW_SERVER_NAME
$Local_Password = $ENV:ADMIN_PASSWORD
$Local_Username = $ENV:ADMIN_ACCOUNT_NAME
define sys_get_account_id() return $account_id do
# Fetches the account id of "this" cloud app using the default tags set on a
# deployment created by SS.
# selfservice:href=/api/manager/projects/12345/executions/54354bd284adb8871600200e
#
# @return [String] The account ID of the current cloud app
call get_tags_for_resource(@@deployment) retrieve $tags_on_deployment
$href_tag = map $current_tag in $tags_on_deployment return $tag do
if $current_tag =~ "(selfservice:href)"
$tag = $current_tag
# ---
# RightScript Name: Azure - Set Static IP - Windows
# Description: Make a IP static for azure
# Inputs:
# AZURE_ACCOUNT:
# Category: Azure
# Description: AzureAD username
# Input Type: single
# Required: true
# Advanced: false
name "Package: sys_log"
rs_ca_ver 20160622
short_description "Provides logging functionality for sending logs to audit entries in CM"
package "sys_log"
########################################################
# USAGE
#
# This package provides log functions to log data to audit entries. You can use the
# `summary` definition to set the audit summary and the `detail` definition to add to
#EXAMPLE params:
#$name = "CloudAppName"
#$options = [
# {
# "name": "param_name",
# "type": "string",
# "value": "param_value"
# },
# {
# "name": "param_name2",
#Usage:
# -Execute entire script to load functions
# -Execute the Install-RSC function
# -Execute the Publish-CAT function
# After loading functions, built-in help notes are available. ie. Get-Help Publish-CAT
function Publish-CAT {
<#
.SYNOPSIS
Upload a CAT to RightScale Self-Service. And optionally publish the CAT to the Self-Service Catalog.
#API Docs: http://reference.rightscale.com/selfservice/manager/index.html#/1.0/controller/V1::Controller::ScheduledAction/create
#$name is a human-readable name for the scheduled action. ie "my scheduled action"
#$action is one of: "launch","start","stop","terminate","run"
#$operation_name is only necessary if $action = "run". it's value is the custom operation name
#$recurrence is an RRULE as described by RFC 5545. ie "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"
#$timezone in standardized tzinfo names (http://www.iana.org/time-zones) ie "America/Los_Angeles" or "UTC"
#$first_occurrence in ISO-8601 DateTime format. ie "2014-07-24T00:00:00+00:00"
#Create RUN scheduled action:
rs_ss.scheduled_actions.create(