Skip to content

Instantly share code, notes, and snippets.

View rheid's full-sized avatar

Ralf Heid rheid

View GitHub Profile
@rheid
rheid / get-spversion.ps1
Created February 8, 2016 20:42
PowerShell script to display version info for installed SharePoint product and language packs
# PowerShell script to display SharePoint products from the registry.
Param(
# decide on whether all the sub-components belonging to the product should be shown as well
[switch]$ShowComponents
)
# location in registry to get info about installed software
$RegLoc = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
@rheid
rheid / Get-AzureResourceGroupGalleryTemplate.ps1
Last active February 12, 2016 13:25
Get-AzureResourceGroupGalleryTemplate from new Azure REST Interface
# Retrieve all available items
$allGalleryItems = Invoke-WebRequest -Uri "https://gallery.azure.com/Microsoft.Gallery/GalleryItems?api-version=2015-04-01&includePreview=true" | ConvertFrom-Json
# Get all items published by Microsoft
$allGalleryItems | Where-Object { $_.PublisherDisplayName -eq "Microsoft" }
# Get all gallery items with "SQL" in the description
$allGalleryItems | Where-Object { $_.Description -match "SQL" }
# Save default template for all items under directory "C:\Templates"
@rheid
rheid / add-iiswebsite.ps1
Last active February 23, 2016 20:28
Create IIS WebSite from Folder-Struktur
$Path = "C:\inetpub\wwwroot\static"
$Folders = Get-ChildItem $Path -attributes D
$loop = 0
foreach ($folder in $Folders)
{
#Get Folder-Informationen form Filessystem
$loop = $loop + 1;
$sitefilepath = $folder.Fullname
$sitehostname = $folder.name
@rheid
rheid / add-iiscerts.ps1
Last active September 2, 2016 11:01
Import SSL certificate to IIS webserver what is inside the root filesystem
$Path = "C:\inetpub\wwwroot\static"
$Folders = Get-ChildItem -path $Path -Recurse -Include *.pfx
$pass = $mypwd = ConvertTo-SecureString -String "<Passwort>" -Force –AsPlainText
foreach ($file in $Folders)
{
#Get Folder-Informationen form Filessystem
$loop = $loop + 1;
$sitefilepath = $file.Fullname
@rheid
rheid / add-iisbindssl.ps1
Created February 23, 2016 21:29
Add the matching IIS certificate to website and active SNI
$Path = "cert:\localmachine\my"
$Certs = Get-ChildItem -path $Path
foreach ($cert in $Certs)
{
#Get Folder-Informationen form Filessystem
$loop = $loop + 1;
foreach ($name in $cert.DnsNameList)
{
@rheid
rheid / FeatureActivation.ps1
Created March 21, 2016 14:40
SharePoint Feature Activation
$LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
$LogFile = ".\FeatureActivation-$LogTime.rtf"
cls
##================================================================================================
## Description : Feature Activation Demo -
## Author : Sathish Nadarajan
@rheid
rheid / exportSPFeatureIDs.ps1
Created March 21, 2016 14:43
SharePoint Export Feature ID
//Export Features ID, DisplayName
Get-SPFeature | select ID, DisplayName, Scope, CompatibilityLevel | Export-Csv c:\Features.csv
//Export all Features properties to CSV
get-SPFeature | Export-Csv c:\AllFeaturesProp.csv
@rheid
rheid / CreateListCSom.js
Created April 27, 2016 16:09
How to set any SP.Field Value with JSOM (Javascript) in Sharepoint 2013 to New SP.Listitem
function createListItem() {
var clientContext = new SP.ClientContext(_spPageContextInfo.siteAbsoluteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('TestList');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
//Single line of text
oListItem.set_item('Title', 'My New Item!');
//Single Choice
@rheid
rheid / sptax.cs
Created June 9, 2016 10:27
SharePoint Client Objekt Model (CSOM) read TaxonomyField
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Taxonomy;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
namespace ICT.SharePoint.SPEvents.Events
{
@rheid
rheid / copy-splistitem.ps1
Created July 4, 2016 06:45
Copy SharePoint List Item
Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
try
{
$srcListSiteUrl = "https://sp.bizerba.com/sites/27261"
$SourceListName = "SiteMetadataPublic"
$dstListSiteUrl = "https://sp.bizerba.com/sites/27261"
$DestinationListName = "SiteMetadata"