Skip to content

Instantly share code, notes, and snippets.

View abelal83's full-sized avatar

Abu Belal abelal83

View GitHub Profile
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
$manager = new-object Microsoft.Web.Administration.ServerManager
# load appHost config
$config = $manager.GetApplicationHostConfiguration()
Write-Host "Unlocking system.webServer/handlers"
$section = $config.GetSection('system.webServer/handlers')
$section.OverrideMode = 'Allow'
$manager.CommitChanges()
Write-Host "Unlocked system.webServer/handlers"
@abelal83
abelal83 / Serene User Auth
Created January 7, 2018 22:20
Serene permission service modification to allow query against AD
namespace Serene.Administration
{
using Serene.Administration.Entities;
using Serenity;
using Serenity.Abstractions;
using Serenity.Data;
using System;
using System.Collections.Generic;
using System.Web.Security; // added by abelal to support AD role based authentication
@abelal83
abelal83 / SevenZipSharp.psm1
Created January 7, 2018 22:10
Some functions for using SevenZipSharp from powershell
Add-Type -Path "$PSScriptRoot\SevenZipSharp.dll"
function Compress-TextToZipStream
{
##############################
#.SYNOPSIS
#Short description
#
#.DESCRIPTION
#Long description
#
@abelal83
abelal83 / gist:1ab1beb0972c7b01b8682717c9e4cdd1
Created January 7, 2018 22:02
change windows NIC profile
# this was used to get around vmware network card being set to public which powershell remoting does not like
$domain = 2
$workHome = 1
$public = 0
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $nlm.getnetworkconnections()
foreach ($connection in $connections) {
if ($connection.getnetwork().getcategory() -eq $public)