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
/** Run on Master DB **/ | |
/** Change variables to name of VM needing Access to Azure DB **/ | |
DECLARE @vmName1 NVARCHAR(20) = 'AzDO-01' | |
/** Declare query variables **/ | |
DECLARE @query1 NVARCHAR(MAX), | |
@query2 NVARCHAR(MAX) | |
/** Update @vmName1 **/ |
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
/** Run this script on all Configuation and Colletion Databases **/ | |
/** Change variables to name of VM needing Access to Azure DB **/ | |
DECLARE @vmName1 NVARCHAR(20) = 'AzDO-01' | |
/** Declare query variables **/ | |
DECLARE @query1 NVARCHAR(MAX), | |
@query2 NVARCHAR(MAX), | |
@query3 NVARCHAR(MAX) |
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
#region Install AzDO | |
$path = "W:\Downloads\Azure DevOps Server\azuredevopsserver2019.0.1.exe" | |
Start-Process $path -ArgumentList "/Full /Passive" -Wait | |
#endregion |
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
#region Create Scheduled Task as User | |
$jobName = "Azure S2S IP Checker" | |
$filePath = 'C:\Scripts\Update S2S and RRAS.ps1' | |
$cred = Get-Credential -Message "Enter Run As Credentials..." | |
$sj = Get-ScheduledJob -Name $jobName -ErrorAction SilentlyContinue | |
if ($sj.count -gt 0) { | |
Write-Host "$jobName scheduled job already exists..." | |
} | |
else { | |
Write-Host "Creating $jobName scheduled Job..." |
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
$connections = (Get-VpnS2SInterface).Name | |
foreach ($connection in $connections) { | |
Connect-VpnS2SInterface -Name $connection | |
} |
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
function Update-Logs ($content) { | |
$logPath = 'C:\S2S Logs' | |
if (-not (Test-Path -Path $logPath)) {New-Item -Path $logPath -ItemType Directory} | |
$date = Get-Date | |
$lastMonth = $date.AddMonths(-1) | |
$fileName = $date.ToString("yyyy-MM-dd") + "- S2S Log.txt" | |
$filePath = ($logPath + "\" + $fileName) | |
$exists = Test-Path $filePath | |
if ($exists) { | |
$string = (Get-Date).ToShortTimeString().ToString() + " $content" |
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 ( | |
[string]$resourceGroup = "Networking-US-East-2", | |
[string]$localGatewayName = "LocalGateway-HQ", | |
[string]$location = "East US 2", | |
[string]$lgwSubnetPrefix = "192.168.0.0/21" | |
) | |
function Get-LocalIP { | |
$wc = New-Object net.webclient | |
$localIP = $wc.downloadstring("http://checkip.dyndns.com") -replace "[^\d\.]" |
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 ( | |
[string]$subscriptionName = "mySubscription", | |
[string]$resourceGroupName = "Networking", | |
[string]$localGatewayName = "LocalGateway", | |
[string]$userID = "508bb5e1-898e-user-9a71-47de815db2af" | |
) | |
Login-AzureRmAccount -SubscriptionName $subscriptionName | |
$ID = Get-AzureRmResourceGroup $resourceGroup1 | Get-AzureRmLocalNetworkGateway -Name $localGatewayName | select Id |
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 ( | |
[string]$displayName = "SVC-Nework-Gateway-Updater", | |
[string]$firstName = "Network-Gateway", | |
[string]$lastName = "Updater-Account", | |
[string]$upn = "[email protected]", | |
[string]$password = "MyPassword#12345", | |
[string]$usageLocation = "US" | |
) | |
$oCred = Get-Credential -Message "Enter Admin Credentials for O365..." |
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
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted | |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false | |
Install-Module -Name MSOnline -AllowClobber -Confirm:$false |
NewerOlder