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
Initialize-SPPS -siteURL https://tenant.sharepoint.com/ -UserCredential $MYO365cred -IsOnline 1 -Verbose | |
Get-List "TestList" # Creates list variable | |
Get-ListFields -ListTitle $list.Title # Creates listfields variable | |
Get-Listviews -ListTitle $list.Title # Creates listviewIDs variable | |
$fieldstocopy = $listfields | Where-Object { $_.FromBaseType -notlike "True" } |
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
$services = Get-Service -DisplayName Windows* | |
foreach ($service in $services) { | |
Add-Member -InputObject $service -MemberType NoteProperty -Name Description ` | |
-Value $((Get-WmiObject Win32_service -Property name,displayname,status,description -Filter "name='$($service.Name)'").Description) | |
} | |
$services | Select Name,Displayname,Description |
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
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate] | |
"SupportsUUP"=dword:00000001 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator] | |
"EnableUUPScan"=dword:00000001 |
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 Install-ModuleFix { | |
<# | |
.SYNOPSIS | |
Describe purpose of "Install-ModuleFix" in 1-2 sentences. | |
.DESCRIPTION | |
Add a more complete description of what the function does. | |
.PARAMETER Module | |
Describe parameter -Module. |
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
$wr = invoke-webrequest https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 | |
$sbuilder = [System.Text.StringBuilder]::new() | |
$sbuilder.AppendLine('function Install-ps {'} | |
$sbuilder.AppendLine($wr.content) | |
$sbuilder.AppendLine('}') | |
$sbuilder.AppendLine('') | |
$sbuilder.AppendLine('Install-ps -UseMSI -Preview') #Replace this with whatever switches you want to run instead from the ones available in the above script | |
$nsb = [Scriptblock]::Create($sbuilder.ToString()) | |
. $nsb |
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 Prompt | |
{ | |
# Admin ? | |
if( ( | |
New-Object Security.Principal.WindowsPrincipal ( | |
[Security.Principal.WindowsIdentity]::GetCurrent()) | |
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | |
{ | |
# Admin-mark in WindowTitle | |
$Host.UI.RawUI.WindowTitle = "[Admin] " + $Host.UI.RawUI.WindowTitlep |
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 Invoke-StarWarsTheme { | |
<# | |
.SYNOPSIS | |
PowerShell will sing the Star Wars theme. | |
.DESCRIPTION | |
Use [Console]::Beep to make some sound. | |
.EXAMPLE |
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
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force -Scope LocalMachine | |
function Enable-PSTranscription { | |
$basePath = "HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription" | |
if (-not (Test-Path $basePath)) { $null = New-Item $basePath –Force } | |
Set-ItemProperty $basePath -Name EnableTranscripting -Value 1 | |
Set-ItemProperty $basePath -Name OutputDirectory -Value "$env:USERPROFILE\OneDrive\PSTranscripts\$env:COMPUTERNAME\" | |
Set-ItemProperty $basePath -Name EnableInvocationHeader -Value 1 | |
$basePath = "HKLM:\Software\Policies\Microsoft\PowerShellCore\Transcription" |
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 -Module Reflection | |
[CmdletBinding()] | |
param( | |
# The path to a script or name of a command | |
$Command, | |
# If you want to include private functions from a module, make sure it's imported, and pass the ModuleInfo here | |
[System.Management.Automation.PSModuleInfo]$ModuleScope = $( | |
Get-Module $Command -ListAvailable -ErrorAction SilentlyContinue | Get-Module -ErrorAction SilentlyContinue | |
), |
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 Request-YesOrNo { | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$false, Position=1)] | |
[string]$title="Confirm", | |
[Parameter(Mandatory=$true, Position=2)] | |
[string]$message="Are you sure?" |
OlderNewer