This file contains 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
#PowerShell | |
#This script will allow you to remotely enable RDP via PowerShell Remoting | |
$Server = Read-Host -Prompt "Name of server:" | |
Invoke-Command -ComputerName $Server -Credential (Get-Credential) -ScriptBlock { | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0 | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1 | |
Set-NetFirewallRule -DisplayGroup 'Remote Desktop' -Enabled True } |
This file contains 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
param( | |
$Computer ='dc01.contoso.com', | |
$Minutes = -240 | |
) | |
if ($Minutes -ge 0) {$Minutes = 0 - $Minutes} | |
$SelectOuput = @( | |
@{n='ComputerName';e={$_.MachineName}}, | |
@{n='Time';e={$_.TimeCreated}}, |
This file contains 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
# Provide API Refresh Token - http://docs.rightscale.com/cm/dashboard/settings/account/enable_oauth.html | |
$oauthRefreshToken = "<API_REFRESH_TOKEN>" | |
## Get a bearer access token from Cloud Management | |
$oauthUrl = "https://my.rightscale.com/api/oauth2" | |
$oauthHeaders = @{"X_API_VERSION"="1.5"} | |
$oauthBody = @{"grant_type"="refresh_token";"refresh_token"=$oauthRefreshToken} | |
$oauthResult = Invoke-RestMethod -Method Post -Uri $oauthUrl -Headers $oauthHeaders -Body ($oauthBody | ConvertTo-Json) -ContentType "application/json" | |
$accessToken = $oauthResult.access_token |
This file contains 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
$subsciptionId = "<Azure Subscription ID>" | |
Select-AzureRmSubscription -SubscriptionId $subsciptionId | |
$startTime = Get-Date | |
$storageAccounts = Get-AzureRmStorageAccount | |
$totalStorageAccounts = $($storageAccounts.Count) | |
$totalContainers = $null | |
$totalBlobs = $null |
This file contains 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
$headers = @{"accept"="application/json"} | |
$statusPageContent = Invoke-WebRequest -Uri "http://status.rightscale.com" -Headers $headers | |
$components = ($statusPageContent | ConvertFrom-Json).components | |
$componentObject = @() | |
foreach ($component in $components) { | |
$componentObject += [pscustomobject]@{ | |
"name" = $component.name | |
"status" = $component.status | |
} |
This file contains 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
curl -sS -H "accept: application/json" http://status.rightscale.com | jq '.components[] | select(.name == "Cloud Management API 1.5") | .status' |
This file contains 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
((Invoke-WebRequest -Uri "http://status.rightscale.com" -Headers @{"accept"="application/json"} | ConvertFrom-Json).components | Where-Object {$_.name -eq "Cloud Management API 1.5"}).status |
This file contains 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
$errorActionPreference = "stop" | |
$scriptId = "12345678" | |
$rsc = 'C:\Program Files\RightScale\RightLink\rsc.exe' | |
$snapshot_Name = $ENV:SNAPSHOT_NAME | |
$snapshot_Save = $ENV:KEEP_SNAPSHOTS | |
$scheduledTask_Time =$ENV:SCHEDULED_TASK_TIME | |
$scheduledTask_Name = "RightScale Snapshot - $ENV:SNAPSHOT_NAME" | |
if(($ENV:ENABLE_SNAPSHOT -eq $true) -and (!($ENV:KEEP_SNAPSHOTS) -or !($ENV:SCHEDULED_TASK_TIME))) { | |
Write-Output "Error! Must provide value for KEEP_SNAPSHOTS and SCHEDULED_TASK_TIME!" |
This file contains 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
$erroractionpreference = "Stop" | |
$rightlink_dir = 'C:\Program Files\RightScale\RightLink' | |
$decom_reason = & "${rightlink_dir}\rsc.exe" rl10 show /rll/proc/shutdown_kind | |
$rightScriptID = "123456789" | |
If ($decom_reason -eq "terminate") { | |
Write-Output "Instance is terminating. Running script..." | |
#Run RightScript |
This file contains 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
$bcdConfig = & bcdedit.exe /enum | |
foreach($line in $bcdConfig) { | |
if ($line -like "timeout*") { | |
$timeout = $line.replace('timeout','').replace(' ','') | |
if($timeout -ne 0) { | |
Write-Output "Changing timeout from $timeout to 0" | |
& bcdedit.exe /timeout 0 | |
BREAK | |
} |
OlderNewer