Skip to content

Instantly share code, notes, and snippets.

View lazywinadmin's full-sized avatar

François-Xavier Cat lazywinadmin

View GitHub Profile
@lazywinadmin
lazywinadmin / list_perms.sql
Created June 15, 2023 18:40 — forked from onpaws/list_perms.sql
list permissions SQL Server
/* via http://stackoverflow.com/questions/7048839/sql-server-query-to-find-all-permissions-access-for-all-users-in-a-database
Security Audit Report
1) List all access provisioned to a sql user or windows user/group directly
2) List all access provisioned to a sql user or windows user/group through a database or application role
3) List all access provisioned to the public role
Columns Returned:
UserName : SQL or Windows/Active Directory user cccount. This could also be an Active Directory group.
UserType : Value will be either 'SQL User' or 'Windows User'. This reflects the type of user defined for the
SQL Server user account.
@lazywinadmin
lazywinadmin / concat_gopro.sh
Created January 19, 2022 05:09
Concat GoPro mp4 files
# Make sure you get the right files
for f in `ls -tr *.MP4`; do echo "file '$PWD/$f'";done
# Merge the files
fmpeg -f concat -safe 0 -i <(for f in ./*.MP4; do echo "file '$PWD/$f'"; done) -c copy output.MP4
$author = 'francois-xavier cat'
invoke-restmethod -method Get -URI "https://www.powershellgallery.com/api/v2/Search()?`$filter=(startswith(Authors,'$author') and IsLatestVersion)"|
select -expand properties
# Option 1
invoke-restmethod -method Get -URI "https://www.powershellgallery.com/api/v2/Search()?`$filter=(startswith(Id,'PSClass') and IsLatestVersion) or (startswith(Id,'Adsi') and IsLatestVersion)"|
select -expand properties|select -expand downloadcount
# Option 2
$a = find-module az
$a.AdditionalMetadata.Downloadcount # total download
$a.AdditionalMetadata.versionDownloadCount # download for current version
@lazywinadmin
lazywinadmin / meetup-events.ps1
Created March 26, 2019 01:26
Get the list of event for a Meetup.Com User Group
Import-Module MeetupPS
Get-MeetupEvent -GroupName FrenchPSUG -status past |
Select Name,local_date,link, yes_rsvp_count |
Export-csv "Meetup.com-FRPSUG$(Get-Date -format yyyyMMdd).csv" -notype -enco UTF8
@lazywinadmin
lazywinadmin / ExportMVPAllcontrib.ps1
Created March 25, 2019 23:45
Export MVP Contributions in CSV
#https://lazywinadmin.com/2018/01/MVPModule-BackupMyEntries.html#backup-per-year
# Connect to api
$Key = '<Your Secret key>'
Set-MVPConfiguration -SubscriptionKey $Key
# Get All contributions
$AllContrib = Get-MVPContribution -limit 1000
# Retrieve important data and select the useful properties that
# we can use for the next import
@lazywinadmin
lazywinadmin / psgallerystats.ps1
Created March 22, 2019 21:30
Parse PowerShell Gallery (PSGallery) stats in PowerShell Core
((iwr https://www.powershellgallery.com/stats/packages).content -split '\r\n' |sls -Pattern '<a href="/packages/' -Context 0,1)|%{[pscustomobject]@{'Package'=$_.line -replace '<td><a href="/packages/.+/">|</a></td>|\s+';"Stats"=([string]($_.context.postcontext) -replace '\s+|<td><a href="/stats/packages/.+?groupby=Version">|</a></td>')-as [int];"Link"=-join("https://www.powershellgallery.com",$_.line -replace '<td><a href="|/">.+</a></td>|\s+')}}|select -first 100
<#
Package Stats Link
------- ----- ----
SpeculationControl 20195596 https://www.powershellgallery.com/packages/SpeculationControl
AzureRM.profile 2205020 https://www.powershellgallery.com/packages/AzureRM.profile
Carbon 1507538 https://www.powershellgallery.com/packages/Carbon
AzureRM.KeyVault 1398051 https://www.powershellgallery.com/packages/AzureRM.KeyVault
@lazywinadmin
lazywinadmin / Youtube-Rss-Frpsug.ps1
Created February 15, 2019 00:27
Retrieve the last videos of a Youtube channel
irm https://www.youtube.com/feeds/videos.xml?channel_id=UCyxicOKZNm_u1opF_xAYfDA
@lazywinadmin
lazywinadmin / WinPENanoDomainJoin.ps1
Created January 9, 2019 20:57 — forked from dotps1/WinPENanoDomainJoin.ps1
Nano domain join for use in SCCM task sequence!
$source = @'
using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
namespace ECGCAT
{
public class Kernel32
{
[DllImport("Kernel32.dll", SetLastError = true)]
@lazywinadmin
lazywinadmin / WinPENanoDomainJoin.ps1
Created January 9, 2019 17:33 — forked from Ryan2065/WinPENanoDomainJoin.ps1
Nano domain join for use in SCCM task sequence!
$source = @'
using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
namespace ECGCAT
{
public class Kernel32
{
[DllImport("Kernel32.dll", SetLastError = true)]