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 ImportExcel | |
Import-Module ImportExcel | |
$file = Import-Excel -Path "Book1.xlsx" | |
$test = @() | |
foreach ($l in $file) { | |
$test += "$($l.Name) $($l.Surname)" | |
} | |
$test | Export-Excel -Path "Book-Exported.xlsx" |
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 Test-Array { | |
param ( | |
[string[]] $other = @(), | |
[bool[]] $thisValue = @(), | |
[bool[]] $Bold = @(), | |
[bool[]] $Italic = @() | |
) | |
$thisValue.GetType() | |
$bold.GetType() | |
foreach ($value in $thisValue) { |
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
<# | |
.SYNOPSIS | |
Create a new desktop wallpaper from various sources and optionally overlay some text. | |
.DESCRIPTION | |
The script can be run manually, at logon or even as a scheduled task to update the wallpaper regularly | |
Wallpaper sources include: | |
- A solid colour |
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
$Array1 = @() | |
$Element1 = [PSCustomObject] @{ Name = 'Company1'; Count = 259 } | |
$Element2 = [PSCustomObject] @{ Name = 'Company2'; Count = 300 } | |
$Array2 = @() | |
$Element3 = [PSCustomObject] @{ Name = 'Company1'; Count = 25 } | |
$Element4 = [PSCustomObject] @{ Name = 'Company2'; Count = 100 } | |
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
$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 | |
} | |
} |
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
Clear-Host | |
Function Limit-BlockUsageOne { | |
[CmdletBinding()] | |
Param ( | |
$Stop = 1 | |
) | |
Begin { | |
if ($Stop -eq 2) { | |
break |
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
# 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 |
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
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 | |
#> |
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 Get-Sid { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[System.String] | |
$Account, | |
[Parameter(Mandatory = $false, Position = 1)] | |
[System.String] | |
$Domain = $null |
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 Get-Sid { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[System.String] | |
$Account, | |
[Parameter(Mandatory = $false, Position = 1)] | |
[System.String] | |
$Domain = $null |
OlderNewer