Skip to content

Instantly share code, notes, and snippets.

Janik Vonrotz janikvonrotz

Block or report user

Report or block janikvonrotz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@janikvonrotz
janikvonrotz / Instruction.md
Created Jan 29, 2014
PowerShell: Moving an Event Source to a Different Windows Event Log #Markdown #WindowsServer #PowerShell
View Instruction.md

It is typically best practice when developing .NET applications, including SharePoint customizations, to create an event source for Windows Event Logging while installing the application. Each event source on a Windows computer is tied to a specific log upon registration. I recently provided guidance on how to move an event source to use its own brand new event log. The following lines of PowerShell can do this quickly. Unless your .NET application has the event log hardcoded into itself, which it shouldn’t because the event source should be registered to a log during installation, then the move shouldn’t require any code changes.

Remove-EventLog -Source MyCustomApplicationSource
New-EventLog -Source MyCustomApplicationSource -LogName MyNewOrExistingWindowsEventLog

I found that I had to reboot the machine after executing the above lines of PowerShell for this change to fully take effect.

@janikvonrotz
janikvonrotz / Create-PathAndFilename.ps1
Created Feb 6, 2014
PowerShell: Handle not existing file paths or filenames from a unspecific path #PowerShell
View Create-PathAndFilename.ps1
$PathAndFilename = Get-PathAndFilename $Path
if(-not $PathAndFilename.Filename){$PathAndFilename.Filename =$AlternativeFilename}
if(-not $PathAndFilename.Path){$PathAndFilename.Path = (Get-Location).Path}
if(-not (Test-Path $PathAndFilename.Path)){New-Item -Path $PathAndFilename.Path -ItemType Directory}
$Path = Join-Path $PathAndFilename.Path ($PathAndFilename.Filename)
@janikvonrotz
janikvonrotz / CommandLog Cleanup.sql
Created Feb 6, 2014
SQL Server: Schedule SQL Server Maintenance Solution Agent Jobs #SQLServer
View CommandLog Cleanup.sql
/*
Cleanup
CommandLog cleanup one day per week
Job Name: CommandLog Cleanup
Execute on monday at 04:00
*/
USE [msdb]
GO
@janikvonrotz
janikvonrotz / Backup-SPSites.ps1
Created Feb 7, 2014
PowerShell: Backup SharePoint Sites #SharePoint #PowerShell #CompanyIOZ
View Backup-SPSites.ps1
#Backup Settings
$backupPath = "E:\SharePointBackups";
$RentationDays = "1"
#Mail Settings
$emailFrom = "sharepointbackup@vbl.ch"
$emailTo = "helpdesk@vbl.ch"
$smtpServer = "mail.vbl.ch"
$SuccessNotification = 0
######################
@janikvonrotz
janikvonrotz / BuildFarm.ps1
Last active Aug 29, 2015
PowerShell: Install SharePoint 2013 #PowerShell #SharePoint #CompanyIOZ
View BuildFarm.ps1
#Start Schritt 1
$snapin = Get-PSSnapin Microsoft.SharePoint.Powershell -ErrorVariable err -ErrorAction SilentlyContinue
if($snapin -eq $null){
Add-PSSnapin Microsoft.SharePoint.Powershell
}
function Write-Info([string]$msg){
Write-Host "$($global:indent)[$([System.DateTime]::Now)] $msg"
}
@janikvonrotz
janikvonrotz / CheckDBConnection.php
Created Feb 12, 2014
Check Database Connection #PHP #MySQL
View CheckDBConnection.php
<!--
#--------------------------------------------------#
# Title: Check MySQL DB Connection
#--------------------------------------------------#
# File name: CheckDBConnection.php
# Description:
# Tags: mysql, php, connection, check
# Project:
#
# Author: Janik von Rotz
@janikvonrotz
janikvonrotz / Setup-ADFSRelyingPartyTrust.ps1
Created Feb 13, 2014
PowerShell: Setup a Active Directory Federation Service Relying Party Trust #PowerShell #ADFS
View Setup-ADFSRelyingPartyTrust.ps1
# 1. Get your ADFS Federation Metadata
$FederationMetadataUrl = (Get-ADFSEndpoint | where{$_.Protocol -eq "Federation Metadata"}).FullUrl.OriginalString
# 2. Send Url to Umantis
# 3. Add Relying Party Trust
## customer settings
@janikvonrotz
janikvonrotz / Set-SPDefaultPermissions.ps1
Created Feb 14, 2014
PowerShell: Set SharePoint Default Permissions #PowerShell #SharePoint
View Set-SPDefaultPermissions.ps1
<#
$Metadata = @{
Title = "SharePoint Default Settings"
Filename = "Set-SPDefaultSettings.ps1"
Description = ""
Tags = "powershell, script, sharepoint, default settings"
Project = ""
Author = "Janik von Rotz"
AuthorContact = "http://www.janikvonrotz.ch"
CreateDate = "2013-05-07"
@janikvonrotz
janikvonrotz / Create-SPMySiteThumbnails.ps1
Created Feb 14, 2014
PowerShell: Create SharePoint MySite Thumbnails #PowerShell #SharePoint
View Create-SPMySiteThumbnails.ps1
if((Get-PSSnapin 'Microsoft.SharePoint.PowerShell' -ErrorAction SilentlyContinue) -eq $null){Add-PSSnapin 'Microsoft.SharePoint.PowerShell'}
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://mysite.vbl.ch
@janikvonrotz
janikvonrotz / Disable Extended Protection ADFS.ps1
Created Feb 17, 2014
PowerShell: Disable Extended Protection in ADFS 2.0 to allow Google Chrome and Firefox to Authenticate Using NTLM #ADFS #Office365 #PowerShell
View Disable Extended Protection ADFS.ps1
PS C:\Users\su-adfs> Set-ADFSProperties -ExtendedProtectionTokenCheck:None
WARNING: PS0038: This action requires a restart of the AD FS Windows Service. If you have deployed a federation server
farm, restart the service on every server in the farm.
PS C:\Users\su-adfs> iisreset.exe
Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted
You can’t perform that action at this time.