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
| #region Create Log In Task | |
| $user = whoami | |
| $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..." | |
| $sj = Register-ScheduledJob –Name $jobName ` | |
| -ScriptBlock $sb ` |
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
| 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 |
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
| Param ( | |
| [string]$displayName = "SVC-Nework-Gateway-Updater", | |
| [string]$firstName = "Network-Gateway", | |
| [string]$lastName = "Updater-Account", | |
| [string]$upn = "svc_network-updater@yourDomain.onmicrosoft.com", | |
| [string]$password = "MyPassword#12345", | |
| [string]$usageLocation = "US" | |
| ) | |
| $oCred = Get-Credential -Message "Enter Admin Credentials for O365..." |
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
| 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 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
| 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 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
| 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" |