Skip to content

Instantly share code, notes, and snippets.

View AshFlaw's full-sized avatar

AshFlaw

  • The Full Circle
View GitHub Profile
@AshFlaw
AshFlaw / Update-CSOMFolderMetadata.ps1
Created June 19, 2023 08:58
SharePoint Online: Update folder metadata in document library
function Update-CSOMFolderMetadata {
param (
[Parameter(Mandatory=$True)]
$SiteURL,
[Parameter(Mandatory=$True)]
$FileServerRelativeUrl,
$CreatedBy,
$ModifiedBy,
$CreatedOn,
$ModifiedOn,
@AshFlaw
AshFlaw / Update-CSOMFileMetadata.ps1
Last active June 19, 2023 08:56
SharePoint Online: Update file metadata in document library
function Update-CSOMFileMetadata {
param (
[Parameter(Mandatory=$True)]
$SiteURL,
[Parameter(Mandatory=$True)]
$FileServerRelativeUrl,
$CreatedBy,
$ModifiedBy,
$CreatedOn,
$ModifiedOn,
@AshFlaw
AshFlaw / Get-CSOMDocumentLibraryInventory.ps1
Last active June 19, 2023 08:55
SharePoint Online: Get an inventory of files and folders from a document library
function Get-CSOMDocumentLibraryInventory {
param (
[Parameter(Mandatory=$True)]
[string]$SiteURL,
[Parameter(Mandatory=$True)]
[string]$LibraryName,
[int]$BatchSize,
[Parameter(Mandatory=$True)]
[System.Management.Automation.PSCredential]
$Credential
@font-face {
font-family: KaTeX_AMS;
src: url(/static/fonts/KaTeX_AMS-Regular.38a68f7.woff2) format("woff2"), url(/static/fonts/KaTeX_AMS-Regular.7d307e8.woff) format("woff"), url(/static/fonts/KaTeX_AMS-Regular.2dbe16b.ttf) format("truetype");
font-weight: 400;
font-style: normal
}
@font-face {
font-family: KaTeX_Caligraphic;
src: url(/static/fonts/KaTeX_Caligraphic-Bold.342b296.woff2) format("woff2"), url(/static/fonts/KaTeX_Caligraphic-Bold.9634168.woff) format("woff"), url(/static/fonts/KaTeX_Caligraphic-Bold.33d2688.ttf) format("truetype");
@AshFlaw
AshFlaw / Set-StrongCryptoDotNet4.ps1
Created July 6, 2020 07:12
Permanently set .NET and PowerShell to use TLS1.2
# set strong cryptography on 64 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
# set strong cryptography on 32 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
@AshFlaw
AshFlaw / Get-FolderSize.ps1
Created October 7, 2019 11:03
Get size of folder
Function Get-FolderSize {
[cmdletbinding()]
param
(
[Parameter(Mandatory = $false)]
[Alias('Path')]
[String[]]
$BasePath = 'C:\',
[Parameter(Mandatory = $false)]
[Alias('User')]
@AshFlaw
AshFlaw / Set-SQLMSXEncryptionChannelOff.ps1
Created March 5, 2019 19:33
Function to disable SQL Agent MSX Encryption
Function Set-SQLMSXEncryptionChannelOff
{
$Path = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.SE\SQLServerAgent"
$Name = "MsxEncryptChannelOptions"
$DefaultValue = "2"
$NewValue = "0"
$ComputerName = $Env:COMPUTERNAME
$Item = (Get-ItemProperty $Path -Name $Name).$Name
if($Item -eq $DefaultValue)
{
@AshFlaw
AshFlaw / Register-WSUSOnlineAndInstallUpdates.ps1
Created February 24, 2019 16:03
Register MS Online updates provider to WU and install updates.
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d
Get-WUInstall –MicrosoftUpdate –AcceptAll –AutoReboot
@AshFlaw
AshFlaw / Install-dbatools.ps1
Created January 21, 2019 08:36
Function to install dbatools PowerShell Module
function Install-dbatools {
Import-Module dbatools -ErrorAction SilentlyContinue
if((Get-Module | Where-Object {$_.Name -eq "dbatools"}) -eq $null) {
Write-Output "dbatools module installing"
Install-Module dbatools -force
}
else {
Write-Output "dbatools module already installed"
}
}
@AshFlaw
AshFlaw / Create-DbaTools-WatchDbLogins-SQL-Table.sql
Created January 10, 2019 21:43
Create table for dbatools.io function WatchDbLogins to log to
USE [DatabaseLogins]
CREATE TABLE [dbo].[DbaTools-WatchDbLogins](
[ComputerName] [nvarchar](max) NULL,
[InstanceName] [nvarchar](max) NULL,
[SqlInstance] [nvarchar](max) NULL,
[LoginTime] [datetime2](7) NULL,
[Login] [nvarchar](max) NULL,
[Host] [nvarchar](max) NULL,
[Program] [nvarchar](max) NULL,