Skip to content

Instantly share code, notes, and snippets.

@vnau
vnau / SP-FixTemplates.ps1
Last active November 18, 2021 20:40
The script fixes SharePoint Template Files (STP) so that they can be imported while preserving Lookup fields. The STP files are first extracted, the GUIDs are replaced with the corresponding list paths, and subsequently repackaged. All dependent SharePoint Template files must be located in the folder where the script is run.
# The script fixes SharePoint Template Files (STP) so that they can be imported while preserving Lookup fields.
# The STP files are first extracted, the GUIDs are replaced with the corresponding list paths, and subsequently repackaged.
# All dependent SharePoint Template files must be located in the folder where the script is run.
$templatePath=(Get-Item .).FullName
# retrieve list of stp files
$lists = Get-ChildItem -Path $templatePath -Filter *.stp -File -Name| ForEach-Object {
[System.IO.Path]::GetFileNameWithoutExtension($_)
}
@vnau
vnau / backup.ps1
Created March 6, 2020 19:07
PowerShell script to backup files to ZIP archive excluding specific folders
param([Parameter(Mandatory)]$path)
$ErrorActionPreference = "Stop"
# top path that we want to keep in the source code zip file
$subdir = ""
# location of the zip file
$ZipFile = (Get-Item -Path ".\").FullName+"\"+(Split-Path $path -leaf)+".zip"
# change current directory
Set-Location "$path"
@vnau
vnau / svg2ico.cmd
Last active December 14, 2017 15:52
Convert SVG icon with transparent background to ICO file format using ImageMagick
convert -density 384 -background transparent -define icon:auto-resize -colors 256 icon.svg icon.ico
@vnau
vnau / 2gis.au3
Last active June 23, 2018 09:18
Скрипт AutoIt для скрытия рекламных баннеров при старте и закрытии ДубльГис / AutoIt script to hide 2gis splash screens
$ProgramFilesDir = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir")
Run($ProgramFilesDir & "\2gis\3.0\grym.exe")
; Close start banner
Local $hWnd1 = WinWait("[REGEXPTITLE:(?i)(.* - Городская информационная система 2ГИС)]")
While Not ControlCommand($hWnd1,"","Button1","IsEnabled",'')
Sleep(100)
WEnd
WinClose($hWnd1)
; Hide banners