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
| // Paste into your favorite KQL engine such as Log Analytics / Sentinel / Defender / ADX | |
| // https://aka.ms/kustofree | |
| let AbsenceInfo = datatable | |
| ( | |
| StartDate: datetime, | |
| EndDate: datetime, | |
| ActivityDisplayName: string, | |
| AdditionalDetails: dynamic | |
| )[ | |
| '2025-12-24', '2026-01-04', 'OOO - festive season', dynamic(["Dear colleague, I'm out of office for christmas holiday season and will take care of your request once I'm back.", "In urgent cases, find my mobile number in teams.", "Merry Christmas & looking forward to seeing you soon.", "🎄❄️🎁", "// Nicola"]) |
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
| # Check Azure AD Access token | |
| if ($null -eq [Microsoft.Open.Azure.AD.CommonLibrary.AzureSession]::AccessTokens){ | |
| Connect-AzureAD | |
| } else { | |
| $token = [Microsoft.Open.Azure.AD.CommonLibrary.AzureSession]::AccessTokens | |
| Write-Verbose "Connected to tenant: $($token.AccessToken.TenantId) with user: $($token.AccessToken.UserId)" | |
| } |
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-AzureAD | |
| $runAsAccountServicePrincipal = Get-AzureADServicePrincipal -ObjectId "497421d0-5b78-4cf1-bab1-6ad2e3d7f319" | |
| $accountAdminDirectoryRole= Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq "User Account Administrator"} | |
| Add-AzureADDirectoryRoleMember -ObjectId $accountAdminDirectoryRole.ObjectId ` | |
| -RefObjectId $runAsAccountServicePrincipal.ObjectId | |
| Get-AzureADDirectoryRoleMember -ObjectId $accountAdminDirectoryRole.ObjectId |
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 Test-Guid | |
| { | |
| <# | |
| .SYNOPSIS | |
| Validates a given input string and checks string is a valid GUID | |
| .DESCRIPTION | |
| Validates a given input string and checks string is a valid GUID by using the .NET method Guid.TryParse | |
| .EXAMPLE | |
| Test-Guid -InputObject "3363e9e1-00d8-45a1-9c0c-b93ee03f8c13" | |
| .NOTES |
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-MSGraph | |
| Update-MSGraphEnvironment -SchemaVersion "Beta" -Quiet | |
| Connect-MSGraph -Quiet | |
| # Get all autopilot devices (even if more than 1000) | |
| $autopilotDevices = Invoke-MSGraphRequest -HttpMethod GET -Url "deviceManagement/windowsAutopilotDeviceIdentities" | Get-MSGraphAllPages | |
| # Display gridview to show devices | |
| $selectedAutopilotDevices = $autopilotDevices | Out-GridView -OutputMode Multiple -Title "Select Windows Autopilot entities to update" |
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
| # See Microsoft 365 Apps Version history https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date#version-history | |
| $targetVersions = @{ | |
| 'CurrentChannel' = [System.Version]::Parse('16.0.16130.20306') | |
| 'MonthlyEnterpriseChannel1' = [System.Version]::Parse('16.0.16026.20238') | |
| 'MonthlyEnterpriseChannel2' = [System.Version]::Parse('16.0.15928.20298') | |
| 'Semi-AnnualEnterpriseChannel(Preview)' = [System.Version]::Parse('16.0.16130.20306') | |
| 'Semi-AnnualEnterpriseChannel1' = [System.Version]::Parse('16.0.15601.20578') | |
| 'Semi-AnnualEnterpriseChannel2' = [System.Version]::Parse('16.0.14931.20944') | |
| 'CurrentChannel(Preview)' = [System.Version]::Parse('16.0.16227.20094') |
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
| name: Sign PowerShell Scripts | |
| on: | |
| push | |
| env: | |
| ARTIFACT_NAME: PowerShell.Workflows.ScriptSigning | |
| jobs: | |
| sign_scripts: | |
| name: Sign and publish PowerShell scripts as pipeline artifacts |
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
| #Binary search algorithm with O(logn) complexity written in PowerShell | |
| function Invoke-BinarySearch { | |
| [CmdletBinding()] | |
| [OutputType([int])] | |
| param ( | |
| # Array which contains value to search, needs to be sorted | |
| [Parameter(Mandatory)] | |
| [int[]] | |
| $Numbers, |
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
| #Requieres -Version 5.0 | |
| <# | |
| .SYNOPSIS | |
| You can use this script for troubleshooting or engineering purposes to verify if TCP ports are opened. | |
| .DESCRIPTION | |
| With this Script you are able to specify server names and port numbers to check in a CSV File. | |
| The Script generates an CSV output file as a report. |
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-Service LxssManager | Restart-Service |
NewerOlder