Skip to content

Instantly share code, notes, and snippets.

View PrzemyslawKlys's full-sized avatar
🍉
Dreaming about great things! A bit bored...

Przemysław Kłys PrzemyslawKlys

🍉
Dreaming about great things! A bit bored...
View GitHub Profile
@PrzemyslawKlys
PrzemyslawKlys / JEAHelperToolv2.ps1
Created May 20, 2021 07:57
JEA Helper Tool - Version 2.0
########################################################################################
# JEA Helper Tool - Version 2.0
# By the Enterprise Cloud Group (ECG) CAT team
# Please send feedback to brunosa@microsoft.com
########################################################################################
param (
#[String]$SMAEndpointWS = "https://wap01.contoso.com",
[String]$SMAEndpointWS = "",
[String]$SMAEndpointPort = "9090"
@PrzemyslawKlys
PrzemyslawKlys / JEAToolkitHelper1.0.ps1
Last active May 20, 2021 07:57
JEA Toolkit Helper
########################################################################################
# JEA Toolkit Helper
# Version 1.0
# by the Windows Server and System Center CAT team - http://aka.ms/bcb
# Please send feedback to brunosa@microsoft.com
########################################################################################
param (
[String]$SMAEndpointWS = "",
[String]$SMAEndpointPort = "9090"
@PrzemyslawKlys
PrzemyslawKlys / Dynamically generate Where-Object.ps1
Last active April 7, 2021 11:49
Dynamically generate Where-Object based on PSCustomObject
$Test = [PSCustomObject] @{
Name = 'Przemek'
Surname = 'Klys'
"Difffrent parametr" = 'ok'
}
function Get-WhereObject {
[cmdletBinding()]
param(
[Parameter(Mandatory, Position = 0, ValueFromPipeline)][PSCustomObject] $Test
function Remove-WinADSharePermission {
[cmdletBinding(DefaultParameterSetName = 'Path', SupportsShouldProcess)]
param(
[Parameter(ParameterSetName = 'Path', Mandatory)][string] $Path,
[ValidateSet('Unknown')][string] $Type = 'Unknown',
[int] $LimitProcessing = [int32]::MaxValue
)
Begin {
[int] $Count = 0
}
function Get-Sid {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0)]
[System.String]
$Account,
[Parameter(Mandatory = $false, Position = 1)]
[System.String]
$Domain = $null
function Get-Sid {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0)]
[System.String]
$Account,
[Parameter(Mandatory = $false, Position = 1)]
[System.String]
$Domain = $null
@PrzemyslawKlys
PrzemyslawKlys / PowerShellProfile.ps1
Last active September 7, 2019 21:00
PowerShell Profile
Clear-Host
Write-Color "Windows PowerShell"
Write-Color "Copyright (C) Microsoft Corporation. All rights reserved." -LinesAfter 1
<# Alternatively if you don't have Write-Color
Clear-Host
Write-Host "Windows PowerShell"
Write-Host "Copyright (C) Microsoft Corporation. All rights reserved."
Write-Host
#>
@PrzemyslawKlys
PrzemyslawKlys / Example.ps1
Created May 1, 2019 21:34
Small example of skiping $array+=
# Surname list from a web site
$uri = "https://names.mongabay.com/most_common_surnames.htm"
$data = Invoke-WebRequest $uri
$table_surname = $data.ParsedHtml.getElementsByTagName("table") | Select -first 1
[array]$table_surname = $table_surname | select -ExpandProperty innertext
$table_surname = $table_surname.Replace("SurnameApproximate", "").replace("Number%", "").replace("FrequencyRank", "")
$table_surname = $table_surname -split "`n"
[regex]$filter = '[^a-zA-Z]'
$surname_list = $table_surname -replace $filter
@PrzemyslawKlys
PrzemyslawKlys / beginprocessend.ps1
Last active May 1, 2019 07:07
Testing break on Begin/process/End
Clear-Host
Function Limit-BlockUsageOne {
[CmdletBinding()]
Param (
$Stop = 1
)
Begin {
if ($Stop -eq 2) {
break
$lists = Get-PnPList -Includes RootFolder.ServerRelativeUrl, IsCatalog, IsSiteAssetsLibrary
$Rewritten = foreach ($list in $lists) {
[PSCustomObject] @{
Id = $List.Id
Title = $list.Title
Url = $list.RootFolder.ServerRelativeUrl
IsCatalog = $List.IsCatalog
IsSiteAssetsLibrary = $List.IsSiteAssetsLibrary
}
}