Skip to content

Instantly share code, notes, and snippets.

View PCfromDC's full-sized avatar

Patrick Curran PCfromDC

View GitHub Profile
@PCfromDC
PCfromDC / getWacVersion.ps1
Created January 23, 2018 21:00
Get WAC Version
(Invoke-WebRequest https://wac.domain.com/op/servicebusy.htm).Headers["X-OfficeVersion"]
@PCfromDC
PCfromDC / stopVerboseLogging-WAC.ps1
Last active January 24, 2018 15:30
Stop WAC Verbose Logging
Set-OfficeWebAppsFarm -LogVerbosity ""
Restart-Service WACSM
@PCfromDC
PCfromDC / allCAPSRegistryUpdate.ps1
Created January 23, 2018 20:50
Update Registry Computername with all CAPS
$path1 = "HKLM:\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName"
$path2 = "HKLM:\SYSTEM\ControlSet001\Control\ComputerName\ComputerName"
$path3 = "HKLM:\SYSTEM\ControlSet002\Control\ComputerName\ComputerName"
$paths = @($path1,$path2,$path3)
foreach ($path in $paths) {
Set-ItemProperty -Path $path -Name ComputerName -Value $env:COMPUTERNAME.ToUpper()
(Get-ItemProperty -Path $path -Name ComputerName).ComputerName
}
@PCfromDC
PCfromDC / enable-verbose WAC.ps1
Created January 23, 2018 20:34
Enable WAC Verbose Logging
Set-OfficeWebAppsFarm -LogVerbosity "High"
Restart-Service WACSM
@PCfromDC
PCfromDC / updateS2S.ps1
Created December 15, 2017 21:21
Update Azure S2S Gateway IP Address
Param (
[string]$userName = "[email protected]",
[string]$password = "MyPassword#12345",
[string]$subscriptionName = "mySubscription",
[string]$resourceGroup = "Networking-US-East-2",
[string]$localGatewayName = "LocalGateway-HQ",
[string]$location = "East US 2",
[string]$lgwSubnetPrefix = "192.168.0.0/21"
)
@PCfromDC
PCfromDC / Create MSOL User and Add to Service.ps1
Created December 15, 2017 20:59
Create MSOL User and Add to Azure Service RBAC
Param (
[string]$msolDisplayName = "SVC-Nework-Gateway-Updater",
[string]$msolFirstName = "Network-Gateway",
[string]$msolLastName = "Updater-Account",
[string]$msolUpn = "[email protected]",
[string]$msolPassword = "MyPassword#12345",
[string]$msolUsageLocation = "US",
[string]$azureSubscriptionName = "mySubscription",
[string]$azureResourceGroupName = "Networking",
[string]$azureLocalGatewayName = "LocalGateway"
@PCfromDC
PCfromDC / log.txt
Created October 27, 2017 21:21
Value cannot be null. Parameter name: merger
2017-10-27 14:21:32.7678 [Debug] Trying to get HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\14.0
2017-10-27 14:21:32.8098 [Debug] Visual Studio 2015 detected...
2017-10-27 14:21:33.2376 [Debug] git command: Starting process: git rev-parse --show-prefix
2017-10-27 14:21:33.2835 [Debug] git command time: [00:00:00.0498066] rev-parse --show-prefix
2017-10-27 14:21:33.3596 [Debug] Command run:git tfs clone http://418612-papp01:8080/tfs/ApplicationCollection $/AdminServices --debug
2017-10-27 14:21:33.3850 [Debug] No authors file used.
2017-10-27 14:21:33.4007 [Debug] git-tfs version 0.27.0.0 (TFS client library 14.0.0.0 (MS)) (32-bit)
2017-10-27 14:21:33.4241 [Debug] git command: Starting process: git init
2017-10-27 14:21:33.5413 [Info] Initialized empty Git repository in C:/tfsMigration/AdminServices/.git/
@PCfromDC
PCfromDC / Create and Mount Azure File Share.ps1
Created April 4, 2017 01:21
Mount Azure File Share as Local Drive
<#
Add-AzureRmAccount
#>
$subscriptionName = "Visual Studio Enterprise"
$resourceGroup = "storage-pcFileShare"
$location = "east us 2"
$storageAccountName = "pcFileShare"
$fileShareName = "pcFiles"
$driveLetter = "X"
$jobName = "Mount $driveLetter Drive"
@PCfromDC
PCfromDC / downloadAllYammerFiles.js
Last active June 21, 2016 21:50
Download All Yammer Files
function getDownloadLink(el, i) {
'use strict';
var rlastForwardSlash = /.+\//,
fileId = (el.href) ? el.href.replace(rlastForwardSlash, '') : '',
downloadPath = 'https://www.yammer.com/api/v1/uploaded_files/' + fileId + '/download'
;
return downloadPath;
}
function downloadFile(dataUrl) {
'use strict';
@PCfromDC
PCfromDC / restoreUserDatabases.ps1
Last active January 29, 2016 02:26
Restore SQL User Databases Using PowerShell
Import-Module SQLPS -DisableNameChecking -EA 0
$backupPath = "J:\Backups" # location of all the .bak files
$sqlInstance = $env:COMPUTERNAME
$files = Get-ChildItem -Path $backupPath -Filter *.bak
foreach ($file in $files) {
$fileName = $file.Name
$dbName = $fileName.Substring(0,($fileName.Length - 13)) # length based off suffix of "_yyyyMMdd.bak" eg: "_20161901.bak"
Write-Verbose ("Restoring $dbName...") -Verbose
Restore-SqlDatabase -ServerInstance $sqlInstance -Database $dbName -BackupFile $file.FullName -RestoreAction Database -ReplaceDatabase
}