Blog Image

PowerShell

SharePoint Powershell Commands

GoSharePoint Website
Documentation Blog

This blog is based on SharePoint 2013 PowerShell Commands. Please visit my other blog which contains SharePoint Documentation.

Get SP2013 Product Key

General Posted on Tue, June 28, 2016 04:50:25

function Get-SP2013ProductKey {

$map=”BCDFGHJKMPQRTVWXY2346789″

$value = (get-itemproperty “HKLM:\SOFTWARE\Microsoft\Office\15.0\Registration\{90150000-110D-0000-1000-0000000FF1CE}”).digitalproductid[0x34..0x42]

$ProductKey = “”

for ($i = 24; $i -ge 0; $i–) {

$r = 0

for ($j = 14; $j -ge 0; $j–) {

$r = ($r * 256) -bxor $value[$j]

$value[$j] = [math]::Floor([double]($r/24))

$r = $r % 24

}

$ProductKey = $map[$r] + $ProductKey

if (($i % 5) -eq 0 -and $i -ne 0) {

$ProductKey = “-” + $ProductKey

}

}

$ProductKey

}

#Call the function

Get-SP2013ProductKey



Create a Folder Directory

General Posted on Tue, June 28, 2016 04:46:50

# PowerShell’s New-Item creates a folder

$Location = “c:\”

New-Item -Path $Location -Name temp” -ItemType “directory”

#Invoke-Item $Location



Allow to use SharePoint cmdlets

General Posted on Tue, June 28, 2016 04:40:51

#Allow to use SharePoint cmdlets from inside the Windows PowerShell command window

If ((Get-PsSnapin |?{$_.Name -eq “Microsoft.SharePoint.PowerShell”})-eq $null)

{

Add-PsSnapin Microsoft.SharePoint.PowerShell | Out-Null

}