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
$vmc = Get-AzureVM -ServiceName $serviceName -Name $vmName | |
$vmc.VM.ProvisionGuestAgent |
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
$endpointName = "RemoteDesktop" | |
$vms = Get-AzureVM | SELECT ServiceName, Name | |
Foreach ($vm in $vms) | |
{ | |
$vmConfig = Get-AzureVM -ServiceName $vm.ServiceName -Name $vm.Name | |
# if found, remove and update | |
if ($vmConfig | Get-AzureEndpoint -Name $endpointName) | |
{ |
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
workflow Test | |
{ | |
$Cred = Get-AutomationPSCredential -Name "auto" | |
Add-AzureAccount -Credential $Cred | |
Get-AzureVM | |
} |
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
workflow Runbook1 | |
{ | |
} |
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
CREATE PROCEDURE dbo.sp_what | |
@searchFor nvarchar(50) | |
AS | |
-- Find Tables, Views | |
SELECT | |
a.name, | |
a.[object_id], | |
CAST(a.[schema_id] AS VARCHAR(5)) + ' - '+ s.name AS [schema], | |
[type_desc], | |
'EXEC sp_columns [' + a.name + '], [' + s.name +']' AS details, |
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
Get-AzureVM -ServiceName "name_cloud_service" -Name "vm_name" | |
Get-AzureVM -ServiceName "name_cloud_service" -Name "vm_name" | Get-AzureEndpoint |
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
Import-Module SQLPS |
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
Import-Module SQLPS -DisableNameChecking | |
#replace this with your instance name | |
$instanceName = "server\instance"; | |
$server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName; | |
$server.ConnectionContext.ConnectTimeout = 2200; | |
$server.ConnectionContext.StatementTimeout=2200; | |
$databases = $server.Databases; |
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
#Change VMName, Service Name and min/max values in hours | |
$ExpectedUptime = 6 | |
$ForceShutdownAfter = 8 | |
$VMName = "name of VM" | |
$ServiceName = "Name of service" | |
$Now = Get-Date | |
$Wmi = Get-WmiObject -ComputerName $Env:COMPUTERNAME -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem" | |
$LastReboot = $Wmi.ConvertToDateTime($Wmi.LastBootUpTime) | |
$Uptime = $Now - $LastReboot |
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
CREATE PROCEDURE Debugging (@value varchar(150)) | |
AS | |
BEGIN | |
-- Something interesting | |
SELECT CONCAT('hello ', @value) | |
END |