Skip to content

Instantly share code, notes, and snippets.

View pollusb's full-sized avatar

Pollus Brodeur pollusb

View GitHub Profile
@pollusb
pollusb / ms-access.ps1
Created April 14, 2024 18:33 — forked from tniedbala/ms-access.ps1
Powershell for Microsoft Access
# Powershell Functions for MS Access :)
# Here are several functions that cover tasks I tend to do most often in Access (hopefully more to come soon). These are mostly
# just wrappers around Access VBA methods, but this helps me avoid constant googling every time I need to do something in Access.
# example usage is provided at the bottom of the script
# Import CSV file into MS Access database
# office vba documentation: https://docs.microsoft.com/en-us/office/vba/api/access.docmd.transferspreadsheet
function Import-MsAccessCsv
@pollusb
pollusb / Get-DbaMaintenanceSolutionVersion.ps1
Last active August 31, 2023 18:32
Extract Version from stored procedure command text
function Get-DbaMaintenanceSolutionVersion {
param(
$SqlInstance,
$Database = 'master'
)
$query = "select object_definition(object_id) as SQLtxt from $Database.sys.procedures where name = 'DatabaseIntegrityCheck'"
foreach ($sql in $SqlInstance) {
$sp = Get-DbaDbStoredProcedure -SqlInstance $sql -Database $Database -Name DatabaseIntegrityCheck
if ($sp) {
$version = if ($sp.TextBody -match '--// Version: ([\d-]+ [\d\:]+)') {
@pollusb
pollusb / fdc-tag.ps1
Created August 23, 2023 12:43
List dbatools tags
Find-DbaCommand | Select-Object -ExpandProperty Tags -Unique -ErrorAction SilentlyContinue | Sort-Object
@pollusb
pollusb / copy-ifnotpresent.ps1
Last active March 20, 2018 20:09
Copy-IfNotPresent
Function Copy-IfNotPresent {
<#
.SYNOPSIS
Copy file only if not present at destination.
.DESCRIPTION
This is a one file at a time call. It's not meant to replace complex call like ROBOCOPY.
Destination can be a file or folder.
If it's a folder, you can use -Container to force Folder creation when not exists.
If it's a file, you can provide a different name.
.LINK
@pollusb
pollusb / test.md
Last active November 19, 2017 05:24

Un article a propos de script

il faut du texte aussi ici pour expliquer le script

select * from table1
@pollusb
pollusb / Change DB Owner, Compatibility Level and Page Verify
Created October 18, 2013 00:20
Just after migrating/upgrade databases to SQL Server
-- Change DB Owner, Compatibility Level and Page Verify
use master
go
declare @cmptlevel int
select @cmptlevel = compatibility_level from sys.databases where database_id = 1
select 'ALTER DATABASE ['+name+'] SET COMPATIBILITY_LEVEL = ' + cast(@cmptlevel as varchar) + ';'
from sys.databases