Wednesday, 24 February 2016

OneLiners in PowerShell with SharePoint for User

#View Users for Web Application/Site collection
#To view sample sites Get-SpWeb -Site "http://intranet.contoso.com/sites/contoso/"
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2"
#View count of Users
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2" |measure
#View SiteAdmins
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2"|?{$_.IsSiteAdmin -eq $true}
#View Site Auditor
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2"|?{$_.IsSiteAuditor -eq $true}
#View Users starting with j
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2"|?{$_.DisplayName -like "j*"}
#View App Account
Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2"|?{$_.DisplayName -like "*app*"}
#View DisplayNames of all Users
(Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2").DisplayName
#View Emails
(Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2").Email
#View Groups
(Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2").Groups.Name
#View User IDs
(Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2").UserID
#ViewUSer Login
(Get-SPUser -Web "http://intranet.contoso.com/sites/contoso/blog2").UserLogin
Get-SPUserLicense
#View all claim-to-user license mappings
Get-SPUserLicenseMapping -WebApplication "http://w15-sp"
Get-SPUserLicenseMapping
#To add New-SPUserLicenseMapping -SecurityGroup "Viewers" -License Enterprise | Add-SPUserLicenseMapping
#Check if UserLicensing is Enabled
Get-SPUserLicensing
#User PRofile Settings
Get-SPUserSettingsProvider
#ID  of User PRofile Settings
(Get-SPUserSettingsProvider).ProviderIdentifier
#User PRofile Settings Manager
Get-SPUserSettingsProviderManager
# DisplayName of User PRofile Settings Manager
(Get-SPUserSettingsProviderManager).DisplayName
#Id of User PRofile Settings Manager
(Get-SPUserSettingsProviderManager).Id
#Version of User PRofile Settings Manager
(Get-SPUserSettingsProviderManager).Version
#Status of User PRofile Settings Manager
(Get-SPUserSettingsProviderManager).Status
#TypeName of User PRofile Settings Manager
(Get-SPUserSettingsProviderManager).TypeName

Tuesday, 23 February 2016

OneLiners in Powershell with SharePoint for Usage

#Get Usage Application details
Get-SPUsageApplication
#View Usage Definition
Get-SPUsageDefinition
#Usage Service
Get-SPUsageDefinition|select TableName,Description,DaysToKeepDetailedData
#View App related Usage
Get-SPUsageDefinition | ?{$_.Tablename -like "*App*"}|select *
#View Usage Directory Log
(Get-SPUsageService).UsageLogDir

Monday, 22 February 2016

OneLiners in POwerShell with SharePoint for Security

#Get Identity Token ISsuer
Get-SPTrustedIdentityTokenIssuer
#View Trusted Root Authority
Get-SPTrustedRootAuthority
#View all TRusted Root Authority
(Get-SPTrustedRootAuthority).Name
#View TRusted Root Authority for Exchange
(Get-SPTrustedRootAuthority)| ?{$_.Name -like "*Exchange*"}|select Name,Certificate
#View Security Token Issuer
(Get-SPTrustedSecurityTokenIssuer).NameID
#View Service Token ISsuer
Get-SPTrustedServiceTokenIssuer
#NEw Service Token Issuer for Sharepoint trust
New-SPTrustedServiceTokenIssuer -Name "WFEFarmTrust1" -Description "WFEFarm Trust1"  -MetadataEndPoint "https://liveid.com/STS/2007/03/fedmetadata.xml" -WhatIf

OneLiners in PowerShell with SharePoint for Translation Throttling Settings

#View Translation Throtting Settings
Get-SPTranslationThrottlingSetting
# View DiskSizeRequired for TranslationThrottlingSetting
(Get-SPTranslationThrottlingSetting).DiskSizeRequired
# View SiteQuota for TranslationThrottlingSetting
(Get-SPTranslationThrottlingSetting).SiteQuota
# View TenantQuota for TranslationThrottlingSetting
(Get-SPTranslationThrottlingSetting).TenantQuota
# View TypeName for TranslationThrottlingSetting
(Get-SPTranslationThrottlingSetting).TypeName
# View DisplayName for TranslationThrottlingSetting  
(Get-SPTranslationThrottlingSetting).DisplayName
# View Id for TranslationThrottlingSetting
(Get-SPTranslationThrottlingSetting).Id    

OneLiners in PowerShell with SharePoint for Topology/Application Discovery and Load Balancer Service Application

#View Topology Service App Details.Application Discovery and Load Balancer Service Application
Get-SPTopologyServiceApplication
#Load Balance Url
(Get-SPTopologyServiceApplication).LoadBalancerUrl
#View PRoxy of Topology Service App
Get-SPTopologyServiceApplicationProxy
#View BAd List Period
(Get-SPTopologyServiceApplicationProxy).BadListPeriod
#View Display Name
(Get-SPTopologyServiceApplicationProxy).TypeName
#To set LoadBalance URl
Set-SPTopologyServiceApplication -Identity (Get-SPTopologyServiceApplication).ID -LoadBalancerUrl "https://testurl" -whatif

Sunday, 21 February 2016

OneLiners in PowerShell with SharePoint for Timer Jobs

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#View timer jobs for a web application
Get-SPTimerJob -WebApplication "http://w15-sp"
#Site deletion timer job
Get-SPTimerJob -Identity "job-site-deletion"
#View workflow timerjobs
Get-SPTimerJob | ?{$_.Name -like "*workflow*"}
#View Recent Run Timer Jobs run in last hour
Get-SPTimerJob | ?{$_.LastRunTime -ge (Get-Date).AddHours(-1)}|measure
Measure-Command {Get-SPTimerJob | sort LastRunTime -Descending | select * -first 10}
Get-SPTimerJob | ?{$_.Schedule -like "*weekly*"}
Get-SPTimerJob | ?{$_.Schedule -like "*minutes*"}
Get-SPTimerJob | ?{$_.Schedule -like "*daily*"}
#Count of Jobs running hourly
Get-SPTimerJob | ?{$_.Schedule -like "*hourly*"} | measure
Get-SPTimerJob|sort Name|select Name,Description -Unique| out-gridview

Saturday, 20 February 2016

One Liners in PowerShell with SharePoint for Request Management Service

#View Throttling Settings
Get-SPRequestManagementSettings -Identity (Get-SPWebApplication -Identity "http://w15-sp")| Get-SPThrottlingRule
Get-SPThrottlingRule -RequestManagementSettings (Get-SPRequestManagementSettings -Identity (Get-SPWebApplication -Identity "http://w15-sp"))
#View Throttling Rules
$rmset=Get-SPWebApplication -Identity "http://w15-sp" |Get-SPRequestManagementSettings
$rm = Get-SPRequestManagementSettings -Identity (Get-SPWebApplication -Identity "http://w15-sp")
$criteria= New-SPRequestManagementRuleCriteria -Value http -Property url -MatchType StartsWith -CaseSensitive $false
$rmset|Add-SPThrottlingRule -Name "Simple HTTP Rule" -Criteria $criteria -Threshold 4
(Get-SPWebApplication -Identity "http://w15-sp").ThrottlingRules
Get-SPRequestManagementSettings -Identity (Get-SPWebApplication -Identity "http://w15-sp")| Get-SPThrottlingRule
#Adding a rule to for word documents (*.doc)
$criteria= New-SPRequestManagementRuleCriteria -Value ".*\.docx" -Property url -MatchType StartsWith -CaseSensitive $false
Add-SPThrottlingRule -RequestManagementSettings $rm -Name "Simple doc Rule" -Criteria $criteria -Threshold 4
Get-SPRequestManagementSettings -Identity (Get-SPWebApplication -Identity "http://w15-sp")| Get-SPThrottlingRule
$rmset.ThrottlingEnabled
$rmset.ThrottlingRules

#Request Management




Friday, 19 February 2016

OneLiners in PowerShell for State Service Application

#View State Service application(Required by Infopath)
Get-SPStateServiceApplication
#View ID of State Service App
(Get-SPStateServiceApplication).ID
#View Proxy of State Service App
Get-SPStateServiceApplicationProxy
#View Database details of State Service App
Get-SPStateServiceDatabase
#View Databse Connection String
(Get-SPStateServiceDatabase).DatabaseConnectionString

Tuesday, 16 February 2016

OneLiners in PowerShell for Site subscription

#View Site Subscription
Get-SPSiteSubscription
#Create new Site Subscription and bind to site
New-SPSite -Url "http://w15-sp/sites/tenantdemo" -Template "TENANTADMIN#0"   -SiteSubscription (New-SPSiteSubscription)
#Set config
#Error Settings or services required to complete this request are not currently available. 
#Try this operation again later.
#If above error, create NEw SiteSubscription Service App
$guid = New-SPSiteSubscriptionFeaturePack
Set-SPSiteSubscriptionConfig -Identity  http://w15-sp/sites/tenantdemo -FeaturePack 4742e2b9-4a69-48c8-b4a5-b1d5fb09952a
#View Config Information of Site Subscription
Get-SPSiteSubscription|Get-SPSiteSubscriptionConfig
#If error create sitesubscritption
#New-SPSubscriptionSettingsServiceApplication -Name "SubscriptionServiceApp" -ApplicationPool "SettingsServiceAppPool"
#New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication (Get-SPServiceApplication -Name "SubscriptionServiceApp").ID
#Get-SPSiteSubscriptionConfig : Settings or services required to complete this request are not currently available.  
#Try this operation again later.  If the problem persists, contact your administrator.
# Get Information Rights Management Info
Get-SPSiteSubscriptionIRMConfig -Identity "http://w15-sp/sites/tenantdemo"
# Get Subscriptions infor fr ediscovery
Get-SPSiteSubscriptionEdiscoveryHub -Identity "http://w15-sp/sites/tenantdemo"
Get-SPSiteSubscriptionEdiscoverySearchScope -Identity "http://w15-sp/sites/tenantdemo"
# Get Metadata config INfo
Get-SPSiteSubscriptionMetadataConfig -Identity "http://w15-sp/sites/tenantdemo" -ServiceProxy 1e700f36-85f3-4078-862b-73cabc1d9605 
#NEw Site Subcscription Service
New-SPSubscriptionSettingsServiceApplication -Name "SubscriptionServiceApp" -ApplicationPool "SettingsServiceAppPool"
New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication (Get-SPServiceApplication -Name "SubscriptionServiceApp").ID

Sunday, 14 February 2016

OneLiners for PowerShell with SharePoint for Admin not available in Central Administration

Get-SPShellAdmin
#View Site Administration Information which cannot be viewed from UI
Get-SPSiteAdministration -Identity "http://w15-sp" | format-list
#View UsersCount for a site
Get-SPContentDatabase -WebApplication "http://intranet.contoso.com"|Get-SPSiteAdministration | select Url,Title,UsersCount
#View max storage used
Get-SPSiteAdministration -Identity "http://hrweb.contoso.com"| Select -Property Url, OwnerLoginName,@{Name="Storage";Expression={$_.Quota.StorageMaximumLevel}}
#View Sites owned by garthf   
Get-SPSiteAdministration -Filter {$_.Owner -like "*contoso\garthf*"} -Limit 50
#View the total disk used for all web application
Get-SPWebApplication | Get-SPSiteAdministration -Limit All|ForEach-Object {$sum=0}{ $sum+=$_.DiskUsed }{$sum / 1GB}
#View Url of all site collections in a Web Application
Get-SPWebApplication "http://w15-sp" | Get-SPSiteAdministration -Limit ALL | Select URL
#Get all sites starting with http://w15-sp
Get-SPSiteAdministration -Identity "http://w15-sp*" -RegEx -Limit All

Thursday, 11 February 2016

OneLiners for PowerShell with SharePoint for Services

#View Service Context for a site
Get-SPServiceContext -Site "http://w15-sp"
#View SslCertificateStoreName,HttpPort,HttpsPort,SslCertificateFindType,SslCertificateFindValue
SslCertificateFindValue
#View all Service Instance
Get-SPServiceInstance
#View details of Session State Service
Get-SPSessionStateService
#View details of Usage Service
Get-SPUsageService

One Liners for PowerShell with SharePoint for All Service Applications(General)

#View all Service Applications
Get-SPServiceApplication
#View all Service Application Proxy
Get-SPServiceApplicationProxy
#View all Service Application Pools
Get-SPServiceApplicationPool
#View Service Application Proxy Group
Get-SPServiceApplicationProxyGroup
#View Service Application End Point for Access Service Application
Get-SPAccessServiceApplication | Get-SPServiceApplicationEndpoint
#View Service Application End Point for Excel Service Application
Get-SPExcelServiceApplication | Get-SPServiceApplicationEndpoint
#View Service Application End Point for Search Service Application
Get-SPEnterpriseSearchServiceApplication | Get-SPServiceApplicationEndpoint
#View Security for All Service Application
Get-SPServiceApplication | Get-SPServiceApplicationSecurity -Admin

Tuesday, 9 February 2016

OneLiners with PowerShell with SharePoint for Secure Store Service Application

Secure Store in SharePoint 2013 replace the Single Sign on in MOSS 2007.
#Get details of the Secure Store Service
Get-SPSecureStoreApplication -All  -ServiceContext "http://w15-sp"
#Get the Secure Store System Account.a list of user accounts for the secure store system
Get-SPSecureStoreSystemAccount
#Get security token service (STS) for the farm.
Get-SPSecurityTokenServiceConfig
#View ID of STS
(Get-SPSecurityTokenServiceConfig).ID
#View Public Url of STS
(Get-SPSecurityTokenServiceConfig).SecurityTokenServicePublicUrlSuffix
#View Cookie LifeTime
(Get-SPSecurityTokenServiceConfig).CookieLifeTime
#View Services
(Get-SPSecurityTokenServiceConfig).TrustedSecurityTokenServices

Monday, 8 February 2016

OneLiners in PowerShell with SharePoint for Project Server

#View Project Server realted Info
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectWebInstance)
#View Project Server realted URL
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectWebInstance).Url
#View Database Server for Project Server
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectWebInstance).DatabaseServer
#View Database  Name for PRoject Server
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectWebInstance).DatabaseNAme
#View Site  Name for PRoject Server
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectWebInstance).Site
#Get Project Database Quota
Get-SPProjectDatabaseQuota -Url "http://w15-sp/PWA"
#View current state of a Project Web App database
Get-SPProjectDatabaseState -DatabaseServer w15-sp -Name ProjectWebApp
#Get values of an existing record in the Project Server internal watch list for the specified instance of Project Web App
Get-SPProjectLogLevelManager -Url "http://w15-sp/PWA"
#View the OData configuration for the instance of Project Web App
Get-SPProjectOdataConfiguration
#View the list of entities that have the MaxPageSizeOverride option configured
(Get-SPProjectOdataConfiguration).EntitySetsWithMaxPAgeSizeOverride
#View Project Settingss[MaximumIdleWorkersCount,MaximumWorkersCount,
#EditingSessionTimeout,MaximumSessionsPerUser,CachePersistence,MinimumMemoryRequired,
#RequestTimeLimits,ResponseSizeLimits,MaximumProjectSize]
Get-SPProjectPCSSettings -ServiceApplication "Project Server Service Application"
Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectPCSSettings
# View Max Project File Size in GB (Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectPCSSettings).MaximumProjectSize/1Gb
#View Permission Mode Get-SPProjectPermissionMode -Url "http://w15-sp/PWA"
#View Projecct Queue Settings
#MaxDegreeOfConcurrency,MsgRetryInterval,MsgRetryLimit,SqlRetryInterval
#SqlRetryLimit,SqlCommandTimeout ,CleanupSuccessAgeLimit,CleanupNonSuccessAgeLimit
#PeriodicTasksInterval,QueueTimeout,MaxConnections
Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectQueueSettings
#View Maximum Connections for Project Server Queue
(Get-SPServiceApplication | ?{$_.Name -like "*Project*"}|Get-SPProjectQueueSettings).MaxConnections

Sunday, 7 February 2016

OneLiners in PowerShell for Accounts and User Profile

#the pluggable security trimmers that are associated with the User Profile service application proxy
Get-SPPluggableSecurityTrimmer -UserProfileApplicationProxyId $pr.Id
$pr= Get-SPServiceApplicationProxy | ? {$_.TypeName.Contains("Profile")}
#View Process Account
Get-SPProcessAccount
#View the company leader from specific user profile(Error ProfilePropertyCache does not have fc413acb-f0b1-4617-b2f3-f2ef93c7f8bb
Get-SPProfileLeader -ProfileServiceApplicationProxy $pr
#View Application Security for User Profile
#Error:UserProfileApplication.SqlSession has empty ApplicationID
Get-SPProfileServiceApplicationSecurity -ProfileServiceApplicationProxy $pr

Thursday, 4 February 2016

OneLiners for PowerShell with SharePoint for Managed Metada Service

#Get Managed Metada Servicce Application
Get-SPMetadataServiceApplication -Identity "Managed Metadata Service"
#Get ID of Managed Metada Service Application
(Get-SPMetadataServiceApplication -Identity "Managed Metadata Service").ID
#Get Status of Managed Metada Service Application
(Get-SPMetadataServiceApplication -Identity "Managed Metadata Service").Status
#Get Parent of Managed Metada Service Application     
(Get-SPMetadataServiceApplication -Identity "Managed Metadata Service").Parent 
#Get Version of Managed Metada Service Application
(Get-SPMetadataServiceApplication -Identity "Managed Metadata Service").Version        


 #View term stores within a web application
#Managed Metadata - Term Store and other information related to Search
$taxonomy=Get-SPTaxonomySession -Site "http://w15-sp"
#Default Keywords Term Store
$taxonomy.DefaultKeywordsTermStore
#Default Site Collection Term Store
$taxonomy.DefaultSiteCollectionTermStore
#Offline Term Store Names
$taxonomy.OfflineTermStoreNames
$taxonomy.TermStores
$termStore = $taxonomy.TermStores
$termStore.Count
$termStore|select NAme,Groups | format-list
$termGroups = $termStore|select Groups
#View all termssets
foreach($group in $termGroups.Groups)
{
$group | select Id,Description,Name,TermSets
}

OneLiners for PowerShell with SharePoint for Office store App Subscription


#Get the Office Store Default Activation setting Get-SPOfficeStoreAppsDefaultActivation -WebApplication http://intranet.contoso.com

#the Subscription ID setting for the tenant

Get-SPSiteSubscription | Get-SPOfficeStoreAppsDefaultActivation

Monday, 1 February 2016

OneLiners for PowerShell with SharePoint for HealthRule

#Health Analysis
#View all the Category
Get-SPHealthAnalysisRule | select Category -Unique
#View Health Anaylis for Security Category
Get-SPHealthAnalysisRule |?{$_.Category -eq "Security"}
#View Health Anaylis for Configuration Category
Get-SPHealthAnalysisRule |?{$_.Category -eq "Configuration"}
#View Health Anaylis for Availability Category
Get-SPHealthAnalysisRule |?{$_.Category -eq "Availability"}
#View Health Anaylis for Performance Category
Get-SPHealthAnalysisRule |?{$_.Category -eq "Performance"}
#View Health Anaylis for System Category
Get-SPHealthAnalysisRule |?{$_.Category -eq "System"}
#View Health Analysis for "TimerJobs"
Get-SPHealthAnalysisRule |?{$_.Name -like "*timerjob*"}
#View Health Analysis related to "InfoPath"
Get-SPHealthAnalysisRule |?{$_.Name -like "*Infopath*"}
#View Health Analysis related to "UserProfile"
Get-SPHealthAnalysisRule |?{$_.Name -like "*UserProfile*"}
#View Health Analysis related to "Farm"
Get-SPHealthAnalysisRule |?{$_.Name -like "*Farm*"}
#View Health Analysis related to "database"
Get-SPHealthAnalysisRule |?{$_.Name -like "*database*"}
Get-SPHealthAnalysisRule |?{$_.Summary -like "*database*"}