How to delete all mysites on a webapplication


$wa = Get-SPWebApplication -Identity https://mysites.zed2016.de/
$counter = $wa.Sites.Count
$nodeletes = 0
$deletes = 0
Write-Host -ForegroundColor Green „Number of Sitecollections in Webapplication: “ + $counter
for($i= $counter-1; $i -gt 0 ; $i–){
$site = $wa.Sites[$i]
Write-Host -BackgroundColor Yellow „Sitecollection Url: “ + $site.Url
if( ($site.RootWeb.WebTemplate -eq ‚SPSPERS‘) -and ($site.isSiteMaster -ne $true)){
Write-Host -BackgroundColor Green -NoNewline „Is a OneDrive and will be deleted“
$site.Delete()
$deletes++
}
else {
Write-Host -BackgroundColor Yellow -NoNewline „No OneDrive detected“
$nodeletes++
}
}
Write-Host „Number of deleted Sites: “ + $deletes
Write-Host „Number of none deleted Sites: “ + $nodeletes
Write-Host „Done!“

Nintex scheduled workflows never starts on a webapplication


One time a year someone run in trouble and every time this happens i can’t remember the commandlet. So here it is:

NWAdmin.exe -o InstallTimerJob -job ScheduledWorkflows -url http://yourwebappurl/

to install TimerJobs and

NWAdmin.exe -o UninstallTimerJob -job ScheduledWorkflows

to deinstall the timerjobs.

Office Online Server & SharePoint 2016 with Excel Services


To configure this you need an additional action when you connect the systems:

 

New-SPWOPIBinding -ServerName oos2016mz.zed2016.local -AllowHTTP

$Farm = Get-SPFarm $Farm.Properties.Add(„WopiLegacySoapSupport“ ,  „<URL>/x/_vti_bin/ExcelServiceInternal.asmx“);
$Farm.Update();

SharePoint Feature Pack 1 is included in the November 2016 PU


How to modify the App Launcher after install the Feature Pack 1?

 

Get-SPFeature -Identity CustomTiles

If the feature is available then you can register the hidden Custom Tile list with this commandlet:

Enable-SPFeature -Identity CustomTiles -Url http://portal.zed2016.local/ -Force

You can make the list visible over the UI by Powershell:

$web = Get-SPWeb http://portal.zed2016.local/
$list = $web.Lists[„Csutom Tiles“]
$list.Hidden=$false
$list.Update()

Now you can create your first Tile!!!

How to Convert docx to pdf with SharePoint and Powershell


$wordfile = „https://test.zed.local/SDocs/2012-Test.docx&#8220;
$pdffile = „https://test.zed.local/Shared%20Documents/Test-2012.pdf&#8220;
$wasp = Get-SPServiceApplicationProxy | where Typename -EQ ‚Word Automation Services Proxy‘
$converse = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJob($wasp)
$web = Get-SPWeb -Identity https://test.zed.local
$converse.UserToken = $web.CurrentUser.UserToken
$converse.Name = „Manueller Test1“
$converse.Settings.DefaultLanguage = 1033
$converse.Settings.OutputFormat = [Microsoft.Office.Word.Server.Conversions.SaveFormat]::PDF
$converse.AddFile($wordfile,$pdffile)
$converse.Start()

RecoveryModel switch to Simple


Import-Module SQLPS -DisableNameChecking
$si = ‚localhost‘
$svr =  new-object (‚Microsoft.SqlServer.Management.Smo.Server‘) $si
$svr.Databases | where {$_.RecoveryModel -eq ‚Full‘ -and -not $_.isSystemObject} |  ForEach-Object { $_.RecoveryModel = ‚Simple‘ }

The same procedure but now with awesome PowerShell. I love it. It’s super smooth…. 😉