Skip to content

Instantly share code, notes, and snippets.

View nordineb's full-sized avatar

Nordine Ben Bachir nordineb

  • Bekk
  • Oslo, Norway
View GitHub Profile
@nordineb
nordineb / README.md
Last active June 19, 2018 10:42
Using Secure Cipher Suites on Windows

Remove protocols & ciphers

#Requires -Version 4
#Requires -RunAsAdministrator

$ProtocolsToRemove = @('PCT 1.0','SSL 2.0','SSL 3.0','TLS 1.0')

$HashesToRemove    = @('MD5','SHA')

$CiphersToRemove   = @(
@nordineb
nordineb / Get-FolderSize.ps1
Created June 20, 2018 08:41
Get-FolderSize.ps1
[cmdletbinding()]
param(
[Parameter(Mandatory = $false)]
[Alias('Path')]
[String[]]
$BasePath = 'C:\',
[Parameter(Mandatory = $false)]
[Alias('User')]
[String[]]
$FolderName = 'all',
@nordineb
nordineb / README.md
Created June 22, 2018 07:38
Ramdisk on Windows
@nordineb
nordineb / README.md
Created July 11, 2018 08:15
Clear Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess <number>

The parameter is required and is derived from some combination of the following values, represented as a decimal number.

1    = Browsing History
2    = Cookies
4 = Temporary Internet Files
@nordineb
nordineb / README.md
Last active July 13, 2018 08:20
Impact of ShadowCopyBinAssemblies on Startup time/Deployment

Reasons for not using ShadowCopyBinAssemblies

  • Using octopusdeploy
  • application is precompiled
  • drive c: gets fill up

Clean up script

dir IIS:\AppPools  | Stop-WebAppPool -ErrorAction SilentlyContinue 
Stop-Process -Name "w3wp" -Force -PassThru
rmdir -Path "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\" -Force -Recurse
@nordineb
nordineb / README.md
Created July 16, 2018 11:20
nstalling MSI files with powershell the right way

Passing arguments to MSI installers is tricky:

$DataStamp = get-date -Format yyyyMMddTHHmmss
$logFile = '{0}-{1}.log' -f $file.fullname,$DataStamp
$MSIArguments = @(
    "/i"
    ('"{0}"' -f $file.fullname)
 "/qn"
@nordineb
nordineb / InstallConfigureRemoteDesktopGateway.ps1
Created July 17, 2018 16:31
Configure Remote Desktop Gateway
<#
.SYNOPSIS
This script:
Creates a new resource group
Creates a VNet with two subnets in the RG
Allocates a static public IP
Creates a NSG and adds rules permitting TCP 3389, 80 and 443
Launches a WinSrv2012R2 instance
Configures RDG server via Remote Desktop Services PowerShell provider using a DSC configuration
The DSC configuration:
@nordineb
nordineb / readme.MD
Last active November 8, 2018 14:08
Connecting to Azure SQL By Using Azure Active Directory Authentication

Using Azure AD for Azure SQL authentication

  • To add Azure AD authentication to Azure SQL, you must first assign an AAD group or user as the database administrator. Removing it will disable AAD authentication, adding it gain will enable Azure AAD again (all users that have been granted access will still have access).
  • Azure SQL Authentication will still work. You can use the Azure SQL admin account to access the database.

Creating the database and assigning an AAD group

  • Create an Azure SQL Database
  • Assign an AAD administrator
  • Create an AAD Group called dbaccessors and add an AAD User to the group