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
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"blocks": [ | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"background": "#21c7a8", | |
"foreground": "#011627", | |
"leading_diamond": "\u256d\u2500\ue0b6", |
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
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
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
#Requires -Version 7 | |
# Version 1.4.0 | |
# Cross-platform PowerShell profile based on https://devblogs.microsoft.com/powershell/optimizing-your-profile/ | |
# check if newer version | |
$gistUrl = 'https://api.github.com/gists/a4e366e6b01f0b70eae90557dfc9d21d' | |
$latestVersionFile = [System.IO.Path]::Combine("$HOME", '.latest_profile_version') | |
$versionRegEx = '# Version (?<version>\d+\.\d+\.\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
function r { | |
if (-not (Get-Module -Name PoSHue)) { | |
Import-Module -Name PoSHue | |
} | |
$BridgeAPIKey = $env:HueAPIKey | |
$BridgeIPAddress = '10.0.1.236' |
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
Install-Module -Name SqlServer -Scope CurrentUser | |
$cred = Get-Credential | |
# Executing a DAX-query to retrieve the property we need in a given scenario | |
Invoke-ASCmd -Credential $cred -Query "EVALUATE(VALUES(Customers[Id]))" -Server "powerbi://api.powerbi.com/v1.0/myorg/ContosoWorkspace" -Database "CustomerData" | |
# The returned data is an XML-string, so we can cast the data to an XML-typed variable in PowerShell | |
[xml]$Data = Invoke-ASCmd -Credential $cred -Query "EVALUATE(VALUES(Customers[Id]))" -Server "powerbi://api.powerbi.com/v1.0/myorg/ContosoWorkspace" -Database "CustomerData" |
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
Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser | |
$Credential = Get-Credential | |
Connect-PowerBIServiceAccount -Credential $Credential | |
$Workspace = Get-PowerBIWorkspace -Name 'HR Data' | |
Get-PowerBIDataset -Workspace $Workspace | ft name,ConfiguredBy,IsRefreshable |
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
Configuration HybridFileServer | |
{ | |
param ( | |
$AzureCredential = (Get-Credential) | |
) | |
Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 8.4.0.0 | |
Import-DscResource -ModuleName PSDesiredStateConfiguration | |
Import-DscResource -ModuleName PackageManagement -ModuleVersion 1.2.4 | |
Import-DscResource -ModuleName AzureFileSyncAgentDsc -ModuleVersion 1.1.5 |
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
Configuration HybridFileServer | |
{ | |
param ( | |
$AzureCredential = (Get-Credential) | |
) | |
Import-DscResource -ModuleName PSDesiredStateConfiguration | |
Import-DscResource -ModuleName AzureFileSyncAgentDsc -ModuleVersion 1.1.5 | |
Node FS01 { |
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
# Define the Get-Office365Endpoint function in the current PowerShell session | |
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/janegilring/PSCommunity/master/Office%20365/Get-Office365Endpoint.ps1')) | |
# Retrieve endpoints for Exchange Online and filter on TCP port 25 | |
$ExchangeOnlineEndpoints = Get-Office365Endpoint -Services Exchange | |
$ExchangeOnlineSMTPEndpoints = $ExchangeOnlineEndpoints | Where-Object { | |
$PSItem.ip -and | |
$PSItem.DisplayName -eq 'Exchange Online' -and |
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
# Step 1 - Enable MSI on the resource - in this case a virtual machine | |
# Step 2 - Assign permissions to the MSI - in this example full permissions to Azure AD | |
$Principal = Get-AzureADServicePrincipal -searchstring MGMT-AZ-01 | |
$Role = Get-AzureADDirectoryRole | Where-Object DisplayName -Like 'Company Administrator' | |
Add-AzureADDirectoryRoleMember -ObjectId $Role.ObjectId -RefObjectId $Principal.ObjectId | |
# Step 3 - Get an access token. Note that the resource we are requesting a token for is https://graph.windows.net | |
$response = Invoke-WebRequest -UseBasicParsing -Uri 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://graph.windows.net/' -Method GET -Headers @{Metadata="true"} |
NewerOlder