Skip to content

Instantly share code, notes, and snippets.

View jmelosegui's full-sized avatar

Juan Manuel Elosegui jmelosegui

View GitHub Profile
-- Detect
sp_change_users_login 'report'
-- Repair
SELECT 'EXEC sp_change_users_login ''Update_One'', '''+[name]+''', '''+[name]+''''
FROM sys.database_principals WHERE
type_desc='SQL_USER'
and NAME NOT IN ('dbo','guest','INFORMATION_SCHEMA','sys')
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<!-- This will allow the config file to be copied to any project referencing the project that need the config transformation -->
<PropertyGroup>
<AllowedReferenceRelatedFileExtensions>
$(AllowedReferenceRelatedFileExtensions);
.dll.config
</AllowedReferenceRelatedFileExtensions>
@jmelosegui
jmelosegui / Add-ChromeExtensions.ps1
Created June 28, 2017 18:04
Add extension to Chrome
[CmdletBinding()]
param()
Function Get-RegistryKeyPropertiesAndValues
{
Param(
[Parameter(Mandatory=$true)]
[string]$path
)
@jmelosegui
jmelosegui / Spy-Cmdlet.ps1
Created July 3, 2017 19:21
Reflect Powershell CmdLet using ICSharpCode ILSpy.
function Spy-Cmdlet {
param(
[Management.Automation.CommandInfo]$command
)
if ($input) {
trap { $_; break }
$command = $input | select -first 1
}
@jmelosegui
jmelosegui / GetLDAPUserInfo.ps1
Created March 1, 2018 13:27
The script will receive a path to a text file containing one GUID per line, loop over each line and search for the user info (Full Name) then generate a CSV file with the user info
param(
[Parameter(Mandatory=$true)]
$filePath
)
$accountsFilter= ""
Get-Content -Path $filePath | ForEach-Object {
if($_.Trim()){
$accountsFilter += "(sAMAccountName=$_)"
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$ConfigurationDataFile
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "SilentlyContinue"
@jmelosegui
jmelosegui / vs-code.json
Created March 8, 2018 20:23
Settings to use commander as me console application with in vscode
"terminal.external.windowsExec": "C:\\dev\\utils\\cmder\\Cmder.exe",
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows" : ["/K","C:\\dev\\utils\\cmder\\vendor\\init.bat"],
@jmelosegui
jmelosegui / VideoToGif
Last active September 30, 2018 15:46
convert video into a gif using docker and ffmpeg
docker run --rm --volume ${pwd}:/ourtput jmelosegui/ffmpeg -i output/video.mp4 /output/video.gif
@jmelosegui
jmelosegui / Get-InstalledSoftware.ps1
Created January 10, 2019 16:53
Retrieves a list of all software installed you can filter by name or guid
function Get-InstalledSoftware
{
<#
.SYNOPSIS
Retrieves a list of all software installed
.EXAMPLE
Get-InstalledSoftware
This example retrieves all software installed on the local computer
.PARAMETER Name
rundll32 dfshim CleanOnlineAppCache