Skip to content

Instantly share code, notes, and snippets.

View nvnivs's full-sized avatar

Nuno Pereira nvnivs

View GitHub Profile
@nvnivs
nvnivs / build.bat
Last active August 29, 2015 13:57
Batch to invoke a Psake build
powershell -NonInteractive -Command "& { Import-Module .\psake.psm1; Invoke-Psake .\psake-build.ps1 %*; exit !($psake.build_success); }"
@nvnivs
nvnivs / Psake-Build.ps1
Last active May 10, 2023 15:44
Generic Psake build script
Properties {
$baseDir = Resolve-Path .
$project = Split-Path $baseDir -Leaf
$artifactDir = "$baseDir\Build\Packages"
$version = "1.0.1"
}
Task Default -Depends Build
Task Clean {
if (Test-Path "$baseDir\build") {
@nvnivs
nvnivs / Update-AssemblyInfo.ps1
Last active August 29, 2015 13:57
Recursivelly updates the version of AssemblyInfo.cs files
<#
.Synopsis
Recursively updates the version of AssemblyInfo.cs files
.Parameter baseDir
The root directory from which to recursively search for AssemblyInfo files
Defaults to the directory of the script.
.Link
https://gist.github.com/z0c
#>
@nvnivs
nvnivs / Acl-RemoveInheritablePermissions.ps1
Last active August 29, 2015 14:02
Disables "Include inheritable permissions from this object's parent" to a given folder
<#
.Synopsis
Recursively updates the version of AssemblyInfo.cs files
.Parameter baseDir
The root directory from which to recursively search for AssemblyInfo files
Defaults to the directory of the script.
.Link
https://gist.github.com/z0c
#>
@nvnivs
nvnivs / VutureVx-DevelopmentSetup.ps1
Last active October 22, 2015 10:24
@PowerShell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/z0c/f3541a9d083c8caf0b04/raw/'))"
<#
.Synopsis
Installs all required components for Vuture Vx development on a vanilla environment
.Link
https://gist.github.com/z0c/f3541a9d083c8caf0b04
#>
# DEPRECATED: Moving to Chef
# Broken due to changes in chocolatey 0.9.9
# Custom package sources not implemented in current version of chocolatey
@nvnivs
nvnivs / List-Iis6SiteBindindsAndARecord.ps1
Last active August 29, 2015 14:07
Iterates through enabled IIS 6 websites and lists their bindings and A records. Useful in preparation to decommission Windows 2003 web servers. @PowerShell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/z0c/1386ec085f71409d6ee0/raw/'))"
<#
.Synopsis
Iterates through enabled IIS 6 websites and lists their bindings and A records.
Useful in preparation to decommission Windows 2003 web servers.
#>
$output = @()
$sites = Get-WmiObject -Class IIsWebServerSetting -Namespace "root\microsoftiisv2" -filter "ServerAutoStart=True"
foreach ($site in $sites) {
foreach ($binding in $site.ServerBindings) {
@nvnivs
nvnivs / SslV3-Disable.ps1
Last active August 29, 2015 14:07
Disables SSL v3 protocol on IIS for POODLE vulnerability. Requires a server restart to become effective.
<#
.SYNOPSIS
Disables SSL v3 protocol on IIS for POODLE vulnerability
.LINK
https://www.digicert.com/ssl-support/iis-disabling-ssl-v3.htm
#>
function Create-SubKey {
param(
[parameter(position=0)]$path,
@nvnivs
nvnivs / SslV2-Disable.ps1
Created October 30, 2014 11:22
Disables SSL v2 protocol on IIS
<#
.SYNOPSIS
Disables SSL v2 protocol on IIS
#>
function Create-SubKey {
param(
[parameter(position=0)]$path,
[parameter(position=1)]$key,
[parameter(position=2)]$subKey
@nvnivs
nvnivs / FileUtils.psm1
Last active August 29, 2015 14:24
Calculates the total size used by child folders of the specified location
function Get-TreeLength {
<#
.SYNOPSIS
Calculates the total size used by child folders of the specified location
.PARAMETER path
The root path
.PARAMETER depth
How many levels deep in the folder structure to go.
Defaults to 0, displays sizes of all subfolders of path
The higher the depth value is the slower it will be to fetch the inital
@nvnivs
nvnivs / Create-FolderJunction.ps1
Created November 6, 2015 13:49
Create a junction path between two folders
# REMARK: By default UNC to local junctions are disabled
# To find out run 'fsutil behavior query SymlinkEvaluation'
# To enable run 'fsutil behavior set SymlinkEvaluation R2L:1'
$source = 'd:\folder-a'
$target = 'd:\folder-b'
Robocopy $source $target /MIR /R:12 /W:5
Invoke-Expression "cmd.exe /c attrib +r $source\\*.* /s"