Category: PowerShell
-
Search/Identify blocked file types in SharePoint
In SharePoint 2016 On-Prem, Microsoft has reduced the number of blocked file types from previous versions of SharePoint. It is totally different than the SharePoint 2010 / 2013. In SharePoint 2013, there are 105 default file types that are blocked by default but in SharePoint 2016, this number goes all the way down to 6.…
-
Copying Directory Structures without Files
I am in the process of uploading huge amount of files and folder structure to SharePoint libraries using OneDrive client. for this work, I need to refer to the existing file share structure many times without having to copy terabytes of data. Here is my little utility code: robocopy D:\Egnyte D:\TargetEgnite /e /xf * Resulting Folder…
-
PowerShell Upload File to Style Library & Sub-Path Location
function UploadFile2StyleLibraryLocation($WebUrl, [String] $SourceFilePath, [String] $StyleLibrarySubPath) { # Open web $web = Get-SPWeb $WebUrl $file = Get-Item $SourceFilePath write-host "Started Uploading File…" $file.FullName # Open file $fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead() # Open Style Library $folder = $web.getfolder("Style Library") # Check whether the file is already exists? $File2Replace = $web.GetFile($folder.Url + $StyleLibrarySubPath + $file.Name) if($File2Replace.Exists…
-
Disable Mobile View on all SPWeb
Param([string]$WebUrl) if($WebUrl -eq ""){ write-host "Please input `$WebUrl` parameter value." -ForegroundColor Red; exit -1 } [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null $WebApp = Get-SPWebApplication $WebUrl foreach($site in $WebApp.Sites){ foreach($web in $site.AllWebs){ $WUrl = $web.Url; Write-Host "Disabling mobile view on web – $WUrl…" -ForegroundColor Gray -NoNewline Disable-SPFeature -identity "d95c97f3-e528-4da2-ae9f-32b3535fbb59" -URL $WUrl -Force -Confirm:$false -ErrorAction SilentlyContinue write-host "done." -ForegroundColor Green…
-
Downloading Azure Subscription File
This approach is useful for scenario where you work on a client workspace, where you don’t directly sign to root level Azure management portal. This was tested on Chrome. Once after you login to client workspace level: https://manage.windowsazure.com/@[YOURCLIENTNAME].onmicrosoft.com#Workspaces/All/dashboard On the same browser copy the following url and hit enter: https://manage.windowsazure.com/publishsettings/ you will notice the subscription…
-
Register Managed Accounts
$account = New-Object System.Management.Automation.PSCredential "READYLAB\sp2013_c2wts", ` (ConvertTo-SecureString "M0dewh1z" –AsPlainText –Force) $managedAccount = New-SPManagedAccount $account
-
Add Feature (Install) IIS on a Windows Server
Import-Module ServerManager $features = @( "Web-WebServer", "Web-Static-Content", "Web-Http-Errors", "Web-Http-Redirect", "Web-Stat-Compression", "Web-Filtering", "Web-Asp-Net45", "Web-Net-Ext45", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Mgmt-Console", "Web-Mgmt-Tools", "NET-Framework-45-ASPNET" ) Add-WindowsFeature $features -Verbose