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
| $ps1Content = @' | |
| $vpnProfiles = "Litware VPN Auto" | |
| function Set-VpnStrategy { | |
| [cmdletbinding()] | |
| param( | |
| [Parameter(Mandatory = $true, ParameterSetName = "Connection", ValueFromPipeline = $true)] | |
| $VpnConnection, | |
| [Parameter(Mandatory = $true, ParameterSetName = "Name")] | |
| [string]$ProfileName, |
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 Get-RrasRoutes { | |
| $config = netsh routing dump | |
| $config | ? { $_.StartsWith("add persistentroute") } | ForEach-Object { | |
| $line = $config | ? { $_.StartsWith("add persistentroute") } | Select -First 1 | |
| $line = $_ | |
| $fields = $line -split " " | |
| $route = @{} | |
| foreach($item in $fields) { | |
| #$item = $fields | Select -First 1 -Skip 2 | |
| $f = $item -split "=" |
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
| { | |
| "properties": { | |
| "displayName": "Enabled DDoS protection", | |
| "policyType": "Custom", | |
| "mode": "All", | |
| "metadata": { | |
| "category": "Network" | |
| }, | |
| "parameters": {}, | |
| "policyRule": { |
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
| $policyName = "DDoS" | |
| $roleToNotify = "Owner" | |
| $policy = Get-AzPolicyDefinition | Where-Object { $_.Properties.displayname -eq $policyName } | |
| $nonCompliantNetworks = Get-AzPolicyState | Where-Object { $_.ComplianceState -eq "NonCompliant" -and $_.PolicyDefinitionName -eq $policy.Name } | Group-Object SubscriptionId | |
| foreach($group in $nonCompliantNetworks) { | |
| $subscriptionId = $group.Name | |
| $networks = $group.Group |
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 ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$sourceAadGroupName, | |
| [Parameter(Mandatory = $true)] | |
| [string]$destinationAdGRoupName, | |
| [Parameter(Mandatory = $false)] | |
| [bool]$RemoveUnmatched = $true | |
| ) | |
| #region Azure Automations connect as RunAs |
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
| Connect-AzAccount | |
| [void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | |
| #region Source group | |
| $sourceGroupName = [Microsoft.VisualBasic.Interaction]::InputBox('Zadejte název zdrojové Azure AD skupiny pro načtení členů:', 'Zdrojová skupina') | |
| if(-not $sourceGroupName) { | |
| Write-Host -ForegroundColor Yellow "Je potřeba zadat jméno skupiny" | |
| return | |
| } |
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
| $nsgName = "litware-sccm012021-05-10T04-44-28-34" | |
| $nsgResourceGroup = "litware-infra" | |
| $priority = 200 | |
| $sourceAddressPrefix = "*" # zdrojový server/prefix pro odesílání SMTP přes ExO | |
| #region Helper functions | |
| function Set-NsgRule { | |
| param( | |
| $nsg, | |
| $smtpEndpoint, |
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
| $configFilePath = "$($env:USERPROFILE)\aad.cnf" | |
| $data = Get-Content $configFilePath | |
| $config = [System.Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($data)) | ConvertFrom-Json | |
| $token = Invoke-ClientCredentialsFlow -Tenant $config.TenantId -ClientId $config.ClientId -ClientSecret $config.ClientSecret | |
| $headers = @{ | |
| "Authorization" = "Bearer $($token.AccessToken)" | |
| } | |
| # Get AAD Users. |
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
| preview |
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
| <# setup | |
| Connect-AzureAD | |
| $PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile | |
| $PasswordProfile.Password = "<SecretPassword>" | |
| $PasswordProfile.ForceChangePasswordNextLogin = $false | |
| $user = New-AzureADUser ` | |
| -DisplayName "Photo Syncer" ` | |
| -PasswordProfile $PasswordProfile ` | |
| -UserPrincipalName "<UserName>" ` |