In Progress
Tuesday, February 25, 2025
Wednesday, June 26, 2024
Set-ExecutionPolicy
The Set-ExecutionPolicy cmdlet change the user preference for the Windows PowerShell execution policy.
Set-ExecutionPolicy [-ExecutionPolicy*] {Unrestricted | RemoteSigned | AllSigned | Restricted | Default | Bypass |Undefined} [[-Scope] {Process | CurrentUser | LocalMachine | UserPolicy | MachinePolicy}] [-Confirm] [-Force][-WhatIf] [<CommonParameters>]
Examples
Set the shell execution policy:
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
The command uses the Force parameter to suppress the user prompt.
Set the scope for an execution policy:
PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned -Force
PS C:\> Get-ExecutionPolicy -List
Remove the execution policy for the current user:
PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Undefined
Other Issues:
When you run an .ps1 PowerShell script you will get the message saying “.ps1 is not digitally signed. The script will not execute on the system.”
To fix this issue you have to run the following command to run Set-ExecutionPolicy and change the Execution Policy setting.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Monday, April 15, 2019
Re-Create WSS_Logging Database in the Sharepoint 2013 Server
My Central Admin --> Monitorng --> Configure usage and health data collection settings do point to WSS_Logging too, but this DB is not present.
you can create manually re-create WSS_Logging DB using in the following powershell script.
Looks like it will work. you should first delete Service Application since it already existed, but than you could recreate it + it created database. No complaints in the event log so far.
Try using this PowerShell:
#Configuration Variables $UsageSAName = "Usage and Health Data Collection Service" $DatabaseName = "WSS_Logging" $DatabaseServer="SPSQL Servername\Instance Name" $UsageLogPath = "C:\UsageLogs\" #Get the Usage Service Application Service Instance $ServiceInstance = Get-SPUsageService #Create new Usage Service application New-SPUsageApplication -Name $UsageSAName -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName -UsageService $ServiceInstance #> $null #Create Service Application Proxy..." $proxy = Get-SPServiceApplicationProxy | where {$_.TypeName -eq "Usage and Health Data Collection Proxy"} $proxy.Provision()
Friday, March 22, 2019
Shrepoint Page library not created After activated Publishing feature. Unable to create any publishing pages
Solution:
Disable-SPFeature –identity 'publishingSite' -URL http://server/ -force
Disable-SPFeature –identity 'PublishingResources' -URL http://server/ -force
Disable-SPFeature –identity 'Publishing' -URL http://server/ -force
Disable-SPFeature –identity 'PublishingLayouts' -URL http://server/ -force
Disable-SPFeature –identity 'publishingweb' -URL http://server/ -force
Enable-SPFeature –identity 'publishingSite' -URL http://server/ -force
Enable-SPFeature –identity 'PublishingResources' -URL http://server/ -force
Enable-SPFeature –identity 'Publishing' -URL http://server/ -force
Enable-SPFeature –identity 'PublishingLayouts' -URL http://server/ -force
Enable-SPFeature –identity 'publishingweb' -URL http://server/ -force
Disable-SPOFeature –Identity "F6924D36-2FA8-4f0b-B16D-06B7250180FA" -Scope Site
Disable-SPOFeature –Identity "AEBC918D-B20F-4a11-A1DB-9ED84D79C87E" -Scope Site
Disable-SPOFeature –Identity "22A9EF51-737B-4ff2-9346-694633FE4416" -Scope Web
Disable-SPOFeature –Identity "D3F51BE2-38A8-4e44-BA84-940D35BE1566" -Scope Site
Disable-SPOFeature –Identity "94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB" -Scope Web
Enable-SPOFeature –Identity "F6924D36-2FA8-4f0b-B16D-06B7250180FA" -Scope Site
Enable-SPOFeature –Identity "AEBC918D-B20F-4a11-A1DB-9ED84D79C87E" -Scope Site
Enable-SPOFeature –Identity "22A9EF51-737B-4ff2-9346-694633FE4416" -Scope Web
Enable-SPOFeature –Identity "D3F51BE2-38A8-4e44-BA84-940D35BE1566" -Scope Site
Enable-SPOFeature –Identity "94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB" -Scope Web
Monday, July 30, 2018
Deploy Sharepoint 2013 Solution Package(WSP Packages) using powershell
Add-SPSolution -LiteralPath "C:\DeployLDACPCustom\LDAPCPCustom.wsp"
Install-SPSolution -Identity "LDAPCPCustom.wsp" -GACDeployment
Install-SPFeature -path "LDAPCPCustom" -CompatibilityLevel 15
Enable-SPFeature -identity "LDAPCPCustom" -URL http://test:30000/
Update Solution Package
Update-SPSolution -GACDeployment -Identity "LDAPCP.wsp" -LiteralPath "C:\DeployLDACP\LDAPCP.wsp"
Remove WSP
De activate feature by manually in the site URL
Disable-SPFeature -identity "LDAPCP.Custom"
Uninstall-SPSolution -Identity "LDAPCPCustom.wsp"
Remove-SPSolution -Identity "LDAPCPCustom.wsp"
Tuesday, January 23, 2018
All Power shell Backup Commands for SharePoint Site
Backup Site Collection
Backup -SPSite http://spuat/sites/SG -Path C:\Backup\SGSite.bak
Restore Site Collection
Restore-SPSite http://spuat:222/sites/SG -Path C:\Backup\SGSite.bak -Force
Tuesday, June 13, 2017
Using PowerShell to Get SharePoint Content database size
Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name, @{Label ="Size in MB"; Expression = {$_.disksizerequired/1024/1024}} >c:\Content_DBsize.txt
The above code will export to C drive and you can change drive for your requirement.