Tuesday, 25 February 2014

PowerShell commands for SharePoint 2010

PowerShell commands for SharePoint 2010 :-


 SPAccessServiceApplication
 Get-SPAccessServiceApplication – Gets an {Access Service} application object.
 New-SPAccessServiceApplication
 Set-SPAccessServiceApplication – Sets a global property for an {Access Services} application.
  
SPAdminJob
Start-SPAdminJob – Immediately starts any waiting administrative job on the local computer.
SPAlternateURL
Get-SPAlternateURL – Return all alternate URLs that match a given criteria.
New-SPAlternateUrl – Creates a new public or internal URL for the specified Web application zone or resource.
Remove-SPAlternateUrl – Completely deletes the specified alternate URL.
Set-SPAlternateUrl – Configures the specified alternate URL.
SPApplicationContent
Install-SPApplicationContent
SPAssignment
Start-SPAssignment – Initiates a new assignment store.
Stop-SPAssignment – Disposes of objects in the provided Assignment Collection.
SPBackupHistory
Get-SPBackupHistory
SPBlobStorageLocation
Move-SPBlobStorageLocation
SPBrowserCustomerExperienceImprovementProgram
Get-SPBrowserCustomerExperienceImprovementProgram
Set-SPBrowserCustomerExperienceImprovementProgram
SPBusinessDataCatalogAclToChildren
Copy-SPBusinessDataCatalogAclToChildren
SPBusinessDataCatalogEntity
Disable-SPBusinessDataCatalogEntity
Enable-SPBusinessDataCatalogEntity
SPBusinessDataCatalogMetadataObject
Get-SPBusinessDataCatalogMetadataObject
Grant-SPBusinessDataCatalogMetadataObject
Revoke-SPBusinessDataCatalogMetadataObject
Set-SPBusinessDataCatalogMetadataObject
SPBusinessDataCatalogModel
Export-SPBusinessDataCatalogModel
Import-SPBusinessDataCatalogModel
Remove-SPBusinessDataCatalogModel
SPBusinessDataCatalogPartition
Remove-SPBusinessDataCatalogPartition
SPBusinessDataCatalogPartitionData
Clear-SPBusinessDataCatalogPartitionData
Export-SPBusinessDataCatalogPartitionData
Import-SPBusinessDataCatalogPartitionData
SPBusinessDataCatalogServiceApplication
New-SPBusinessDataCatalogServiceApplication
Set-SPBusinessDataCatalogServiceApplication
SPBusinessDataCatalogServiceApplicationProxy
New-SPBusinessDataCatalogServiceApplicationProxy
SPBusinessDataCatalogThrottleConfig
Get-SPBusinessDataCatalogThrottleConfig
Remove-SPBusinessDataCatalogThrottleConfig
Set-SPBusinessDataCatalogThrottleConfig
SPCentralAdministration
New-SPCentralAdministration – Creates a new Central Administration Web application.
Set-SPCentralAdministration
SPCertificate
Get-SPCertificate
New-SPCertificate
Remove-SPCertificate
SPCertificateStore
Get-SPCertificateStore
SPClaimMapping
Add-SPClaimMapping
New-SPClaimMapping
Remove-SPClaimMapping
SPClaimProviderManager
Get-SPClaimProviderManager
SPClaimsObject
New-SPClaimsObject
SPClaimsPrincipal
New-SPClaimsPrincipal
SPConfigurationDatabase
Backup-SPConfigurationDatabase – Performs a configuration only backup.
Connect-SPConfigurationDatabase – Connects the computer to an existing configuration database.
Disconnect-SPConfigurationDatabase
New-SPConfigurationDatabase – Creates a new configuration database.
Remove-SPConfigurationDatabase – Permanently removes the specified configuration database.
SPContentDatabase
Check-SPContentDatabase
Dismount-SPContentDatabase
Get-SPContentDatabase
Initialize-SPContentDatabase
Mount-SPContentDatabase
New-SPContentDatabase
Remove-SPContentDatabase
Set-SPContentDatabase
Upgrade-SPContentDatabase
SPContentDeploymentJob
Get-SPContentDeploymentJob
New-SPContentDeploymentJob
Remove-SPContentDeploymentJob
Set-SPContentDeploymentJob
Start-SPContentDeploymentJob
SPContentDeploymentPath
Get-SPContentDeploymentPath
New-SPContentDeploymentPath
Remove-SPContentDeploymentPath
Set-SPContentDeploymentPath
SPCustomLayoutsPage
Get-SPCustomLayoutsPage
Set-SPCustomLayoutsPage
SPDatabase
Get-SPDatabase – Retrieves all properties of a database.
SPDataConnectionFile
Get-SPDataConnectionFile – Returns a data connection file or a collection of data connection files.
Install-SPDataConnectionFile – Installs the provided data connection file.
Set-SPDataConnectionFile – Sets properties of a data connection file.
Uninstall-SPDataConnectionFile – Removes a data connection file.
SPDataConnectionFileDependent
Get-SPDataConnectionFileDependent – Returns administrator deployed form templates on the server dependent on a Universal Data Connection (UDC).
SPDesignerSettings
Get-SPDesignerSettings
Set-SPDesignerSettings
SPDiagnosticConfig
Get-SPDiagnosticConfig
Set-SPDiagnosticConfig
SPDiagnosticsProvider
Get-SPDiagnosticsProvider
Set-SPDiagnosticsProvider
SPediscoveryHub
Set-SPediscoveryHub
SPEdiscoveryHubSearchScope
Get-SPEdiscoveryHubSearchScope
SPediscoveryHubSite
Get-SPediscoveryHubSite
SPEnterpriseSearchAdministrationComponent
Get-SPEnterpriseSearchAdministrationComponent – Returns the administration component for a shared search application.
Set-SPEnterpriseSearchAdministrationComponent – Sets properties of an administration component for a shared search application.
SPEnterpriseSearchCrawlComponent
Get-SPEnterpriseSearchCrawlComponent – Returns a crawl component for a shared search application.
New-SPEnterpriseSearchCrawlComponent – Creates a crawl component for a shared search application.
Remove-SPEnterpriseSearchCrawlComponent – Deletes a crawl component from a shared search application.
SPEnterpriseSearchCrawlContentSource
Get-SPEnterpriseSearchCrawlContentSource – Returns a crawl content source.
New-SPEnterpriseSearchCrawlContentSource – Creates a new crawl content source for a shared search application.
Remove-SPEnterpriseSearchCrawlContentSource – Deletes a specified crawl content source from a search application.
Set-SPEnterpriseSearchCrawlContentSource – Sets the properties of a crawl content source for a shared search application.
SPEnterpriseSearchCrawlCustomConnector
Get-SPEnterpriseSearchCrawlCustomConnector
New-SPEnterpriseSearchCrawlCustomConnector
Remove-SPEnterpriseSearchCrawlCustomConnector
SPEnterpriseSearchCrawlDatabase
Get-SPEnterpriseSearchCrawlDatabase – Returns a crawl store.
New-SPEnterpriseSearchCrawlDatabase – Adds a crawl store to a shared search application.
Remove-SPEnterpriseSearchCrawlDatabase – Deletes a content crawl store.
Set-SPEnterpriseSearchCrawlDatabase
SPEnterpriseSearchCrawlExtension
Get-SPEnterpriseSearchCrawlExtension – Returns the extension rule for the extension collection.
New-SPEnterpriseSearchCrawlExtension – Adds an extension rule to a shared search application.
Remove-SPEnterpriseSearchCrawlExtension – Removes a file name extension from the list of files that can be crawled.
SPEnterpriseSearchCrawlMapping
Get-SPEnterpriseSearchCrawlMapping – Returns a crawl mapping for the search application.
New-SPEnterpriseSearchCrawlMapping – Creates a crawl mapping rule for a shared search application.
Remove-SPEnterpriseSearchCrawlMapping – Deletes a crawl mapping.
SPEnterpriseSearchCrawlRule
Get-SPEnterpriseSearchCrawlRule – Output an CrawlRule Object.
New-SPEnterpriseSearchCrawlRule – Output an CrawlRule Object.
Remove-SPEnterpriseSearchCrawlRule – Output an CrawlRule Object.
Set-SPEnterpriseSearchCrawlRule – Output an CrawlRule Object.
SPEnterpriseSearchCrawlTopology
Get-SPEnterpriseSearchCrawlTopology – Returns a crawl topology.
New-SPEnterpriseSearchCrawlTopology – Adds a crawl topology to a shared search application.
Remove-SPEnterpriseSearchCrawlTopology – Deletes a crawl topology.
Set-SPEnterpriseSearchCrawlTopology – Sets the properties of a crawl topology on a shared search application.
SPEnterpriseSearchExtendedClickThroughExtractorJobDefinition
Get-SPEnterpriseSearchExtendedClickThroughExtractorJobDefinition
SPEnterpriseSearchExtendedConnectorProperty
Get-SPEnterpriseSearchExtendedConnectorProperty
Set-SPEnterpriseSearchExtendedConnectorProperty
SPEnterpriseSearchExtendedQueryProperty
Get-SPEnterpriseSearchExtendedQueryProperty
Set-SPEnterpriseSearchExtendedQueryProperty
SPEnterpriseSearchIndexPartition
Get-SPEnterpriseSearchIndexPartition – Returns an index partition for a query topology.
Set-SPEnterpriseSearchIndexPartition – Sets properties of an index partition for a query topology.
SPEnterpriseSearchLanguageResourcePhrase
Get-SPEnterpriseSearchLanguageResourcePhrase – Returns a language resource phrase.
New-SPEnterpriseSearchLanguageResourcePhrase – Adds a language resource phrase to a shared search application.
Remove-SPEnterpriseSearchLanguageResourcePhrase – Deletes a language resource phrase from a shared search application.
SPEnterpriseSearchManagerService
Get-SPEnterpriseSearchManagerService – Returns the search manager service.
SPEnterpriseSearchManagerServiceInstance
Get-SPEnterpriseSearchManagerServiceInstance – Returns the service manager service instance.
Start-SPEnterpriseSearchManagerServiceInstance – Starts an instance of a search manager service.
Stop-SPEnterpriseSearchManagerServiceInstance – Stops an instance of a search manager service.
SPEnterpriseSearchManagerServiceProxy
Get-SPEnterpriseSearchManagerServiceProxy – Returns the search manager service proxy.
SPEnterpriseSearchMetadataCategory
Get-SPEnterpriseSearchMetadataCategory – Returns a crawled property category.
New-SPEnterpriseSearchMetadataCategory – Adds a crawled property category to a shared search application.
Remove-SPEnterpriseSearchMetadataCategory – Deletes a crawled property category.
Set-SPEnterpriseSearchMetadataCategory – Sets properties of a crawled property category for a shared search application.
SPEnterpriseSearchMetadataCrawledProperty
Get-SPEnterpriseSearchMetadataCrawledProperty – Returns a crawled property.
New-SPEnterpriseSearchMetadataCrawledProperty – Adds a crawled property category to a shared search application.
Set-SPEnterpriseSearchMetadataCrawledProperty – Sets the properties of a metadata crawled property for a shared search application.
SPEnterpriseSearchMetadataManagedProperty
Get-SPEnterpriseSearchMetadataManagedProperty – Returns a managed property.
New-SPEnterpriseSearchMetadataManagedProperty – Adds a managed property to a shared search application.
Remove-SPEnterpriseSearchMetadataManagedProperty – Deletes a metadata managed property.
Set-SPEnterpriseSearchMetadataManagedProperty – Sets the properties of a metadata managed property.
SPEnterpriseSearchMetadataMapping
Get-SPEnterpriseSearchMetadataMapping – Returns the current state of a managed property mapping.
New-SPEnterpriseSearchMetadataMapping – Adds a managed property mapping to a shared search application.
Remove-SPEnterpriseSearchMetadataMapping – Deletes a metadata mapping from a managed property.
Set-SPEnterpriseSearchMetadataMapping – Sets the properties of a managed property mapping for a shared search application.
SPEnterpriseSearchPropertyDatabase
Get-SPEnterpriseSearchPropertyDatabase – Returns a property store.
New-SPEnterpriseSearchPropertyDatabase – Adds a new property store to a shared search application.
Remove-SPEnterpriseSearchPropertyDatabase – Deletes a property store.
Set-SPEnterpriseSearchPropertyDatabase
SPEnterpriseSearchQueryAuthority
Get-SPEnterpriseSearchQueryAuthority – Returns an authoritative page.
New-SPEnterpriseSearchQueryAuthority – Adds an authoritative page to a shared search application.
Remove-SPEnterpriseSearchQueryAuthority – Deletes an authoritative page.
Set-SPEnterpriseSearchQueryAuthority – Sets the properties of an authoritative page for a shared search application.
SPEnterpriseSearchQueryComponent
Get-SPEnterpriseSearchQueryComponent – Returns a query component.
New-SPEnterpriseSearchQueryComponent – Adds a query component to a query topology.
Remove-SPEnterpriseSearchQueryComponent – Deletes a query component.
Restart-SPEnterpriseSearchQueryComponent
Set-SPEnterpriseSearchQueryComponent
SPEnterpriseSearchQueryDemoted
Get-SPEnterpriseSearchQueryDemoted – Returns a demoted site rule.
New-SPEnterpriseSearchQueryDemoted – Adds a demoted site rule to a shared search application.
Remove-SPEnterpriseSearchQueryDemoted – Deletes a demoted site rule.
SPEnterpriseSearchQueryKeyword
Get-SPEnterpriseSearchQueryKeyword – Returns a keyword term.
New-SPEnterpriseSearchQueryKeyword – Adds a keyword term to a shared search application.
Remove-SPEnterpriseSearchQueryKeyword – Deletes a query keyword.
Set-SPEnterpriseSearchQueryKeyword – Sets the properties of a keyword term for a shared search application.
SPEnterpriseSearchQueryScope
Get-SPEnterpriseSearchQueryScope – Returns a query results scope.
New-SPEnterpriseSearchQueryScope – Adds a query results scope to a shared search application.
Remove-SPEnterpriseSearchQueryScope – Deletes a query scope.
Set-SPEnterpriseSearchQueryScope – Sets the properties of a query results scope for a shared search application.
SPEnterpriseSearchQueryScopeRule
Get-SPEnterpriseSearchQueryScopeRule – Returns a shared scope rule.
New-SPEnterpriseSearchQueryScopeRule – Adds a shared scope rule to a query scope.
Remove-SPEnterpriseSearchQueryScopeRule – Deletes query results scope rules.
Set-SPEnterpriseSearchQueryScopeRule – Sets the properties of a shared scope rule for a query scope.
SPEnterpriseSearchQuerySuggestionCandidates
Get-SPEnterpriseSearchQuerySuggestionCandidates
SPEnterpriseSearchQueryTopology
Get-SPEnterpriseSearchQueryTopology – Returns a query topology.
New-SPEnterpriseSearchQueryTopology – Adds a query topology to a shared search application.
Remove-SPEnterpriseSearchQueryTopology – Deletes a query topology.
Set-SPEnterpriseSearchQueryTopology – Sets the properties of a query topology for a shared search application.
SPEnterpriseSearchRankingModel
Get-SPEnterpriseSearchRankingModel – Returns a ranking model.
New-SPEnterpriseSearchRankingModel – Adds a ranking model to a shared search application.
Remove-SPEnterpriseSearchRankingModel – Deletes a ranking model.
Set-SPEnterpriseSearchRankingModel – Sets the properties of a ranking model for a shared search application.
SPEnterpriseSearchSecurityTrimmer
Get-SPEnterpriseSearchSecurityTrimmer – Returns a custom security trimmer.
New-SPEnterpriseSearchSecurityTrimmer – Adds a custom security trimmer to a shared search application.
Remove-SPEnterpriseSearchSecurityTrimmer – Deletes a custom security trimmer.
SPEnterpriseSearchService
Get-SPEnterpriseSearchService – Returns the search service for the farm.
Set-SPEnterpriseSearchService – Sets the properties of a search service for a farm.
SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchServiceApplication – Returns the search service application for a farm.
New-SPEnterpriseSearchServiceApplication – Adds a search service application to a farm.
Remove-SPEnterpriseSearchServiceApplication – Deletes a search service application.
Restore-SPEnterpriseSearchServiceApplication
Set-SPEnterpriseSearchServiceApplication – Sets the properties of a search service application for a farm.
Upgrade-SPEnterpriseSearchServiceApplication
SPEnterpriseSearchServiceApplicationProxy
Get-SPEnterpriseSearchServiceApplicationProxy – Returns the search service application proxy.
New-SPEnterpriseSearchServiceApplicationProxy – Adds a site hit rule for a search application.
Remove-SPEnterpriseSearchServiceApplicationProxy – Deletes a search service application proxy.
Set-SPEnterpriseSearchServiceApplicationProxy – Sets properties of a search service application proxy.
SPEnterpriseSearchServiceInstance
Get-SPEnterpriseSearchServiceInstance – Returns the search service instance for a farm.
Set-SPEnterpriseSearchServiceInstance – Sets the properties of a search service instance.
Start-SPEnterpriseSearchServiceInstance – Starts an instance of a search service.
Stop-SPEnterpriseSearchServiceInstance – Stops an instance of a search service.
SPEnterpriseSearchSiteHitRule
Get-SPEnterpriseSearchSiteHitRule – Returns shared site hit rule.
New-SPEnterpriseSearchSiteHitRule – Output an SiteHitRule Object.
Remove-SPEnterpriseSearchSiteHitRule – Output an SiteHitRule Object.
SPEnterpriseSearchTopology
Export-SPEnterpriseSearchTopology – Saves an existing search topology.
Import-SPEnterpriseSearchTopology – Imports and activates a topology from an XML file.
SPExcelBlockedFileType
Get-SPExcelBlockedFileType
New-SPExcelBlockedFileType
Remove-SPExcelBlockedFileType
SPExcelDataConnectionLibrary
Get-SPExcelDataConnectionLibrary
New-SPExcelDataConnectionLibrary
Remove-SPExcelDataConnectionLibrary
Set-SPExcelDataConnectionLibrary
SPExcelDataProvider
Get-SPExcelDataProvider
New-SPExcelDataProvider
Remove-SPExcelDataProvider
Set-SPExcelDataProvider
SPExcelFileLocation
Get-SPExcelFileLocation
New-SPExcelFileLocation
Remove-SPExcelFileLocation
Set-SPExcelFileLocation
SPExcelServiceApplication
Get-SPExcelServiceApplication – Gets an {Excel Service} application object.
New-SPExcelServiceApplication -
Set-SPExcelServiceApplication – Sets a global property for an {Excel Services} application.
SPExcelUserDefinedFunction
Get-SPExcelUserDefinedFunction
New-SPExcelUserDefinedFunction
Remove-SPExcelUserDefinedFunction
Set-SPExcelUserDefinedFunction
SPFarm
Backup-SPFarm – Creates a backup of an individual database, Web application, or the entire farm.
Get-SPFarm – Returns the local SharePoint farm.
Restore-SPFarm
SPFarmConfig
Get-SPFarmConfig
Set-SPFarmConfig
SPFarmEncryptionKey
Update-SPFarmEncryptionKey – Changes the farm encryption key to a new value and re-encrypts all data currently encrypted with the current farm encryption key with the new one.
SPFeature
Disable-SPFeature – Disables an installed feature at a given scope.
Enable-SPFeature – Enables an installed feature at the given scope.
Get-SPFeature – Returns the features based on a give scope.
Install-SPFeature – Install a feature using the Feature.xml file.
Uninstall-SPFeature – Uninstalls an installed feature definition.
SPFeatureSet
Get-SPFeatureSet
New-SPFeatureSet
Remove-SPFeatureSet
SPFeatureSetMember
Add-SPFeatureSetMember
Remove-SPFeatureSetMember
SPHelpCollection
Get-SPHelpCollection
Install-SPHelpCollection – Install the provided help collection files.
Uninstall-SPHelpCollection
SPIdentityProvider
Get-SPIdentityProvider
New-SPIdentityProvider
Remove-SPIdentityProvider
Set-SPIdentityProvider
SPIisWebServiceApplicationPool
Get-SPIisWebServiceApplicationPool – Returns the specified Internet Information Services (IIS) Application pool.
New-SPIisWebServiceApplicationPool – Creates a new Web service application pool.
Remove-SPIisWebServiceApplicationPool – Completely deletes the specified Web service application pool.
Set-SPIisWebServiceApplicationPool – Changes the account used for the Identity of the specified application pool.
SPIisWebServiceSettings
Get-SPIisWebServiceSettings – Returns the common Web Service settings.
Set-SPIisWebServiceSettings – Configures one or more common settings for all Web services.
SPInfoPathAdministrationFiles
Export-SPInfoPathAdministrationFiles – Saves form templates on the SharePoint Central Administration Web site and UDCX files to a CAB file.
Import-SPInfoPathAdministrationFiles – Imports form templates and UDCX files located on the SharePoint Central Administration Web site.
SPInfoPathFormsService
Get-SPInfoPathFormsService – Returns the forms service settings in the farm.
Set-SPInfoPathFormsService – Sets paramaters for the InfoPath Forms Services.
SPInfoPathFormTemplate
Disable-SPInfoPathFormTemplate – Deactivate a form template from the specified site collection.
Enable-SPInfoPathFormTemplate – Activates a form template in the specified site collection.
Get-SPInfoPathFormTemplate – Returns an InfoPath form template.
Install-SPInfoPathFormTemplate – Installs an InfoPath form template on a farm.
Set-SPInfoPathFormTemplate – Sets properties of an InfoPath form template.
Start-SPInfoPathFormTemplate – Unquieces an InfoPath form template on a farm after an upgrade.
Stop-SPInfoPathFormTemplate – Disables an InfoPath form template on a farm before an upgrade.
Test-SPInfoPathFormTemplate – Validates that a form template can be browser-enabled.
Uninstall-SPInfoPathFormTemplate – Removes a form template from a farm.
Update-SPInfoPathFormTemplate – Upgrades all forms templates on the farm.
SPInfoPathUrl
Update-SPInfoPathUrl – Executes InfoPath XSN/UDC fix-up on SharePoint Services.
SPInfoPathUserAgent
Add-SPInfoPathUserAgent – Adds a user agent to a farm.
Get-SPInfoPathUserAgent – Returns a user agent or all the currently defined user agents for the farm.
Remove-SPInfoPathUserAgent – Removes a user agent.
SPInfoPathWebServiceProxy
Get-SPInfoPathWebServiceProxy – Returns the Web proxy settings for the Web application.
Set-SPInfoPathWebServiceProxy – Sets parameters for an existing SharePoint Web service application.
SPLogEvent
Get-SPLogEvent
SPLogFile
Merge-SPLogFile
New-SPLogFile
SPLogLevel
Clear-SPLogLevel
Get-SPLogLevel
Set-SPLogLevel
SPManagedAccount
Get-SPManagedAccount – Retrieves accounts registered in configuration database.
New-SPManagedAccount – Registers a new managed account.
Remove-SPManagedAccount – Removes a managed account from the farm.
Set-SPManagedAccount – Configures the managed account.
SPManagedPath
Get-SPManagedPath – Returns all managed paths that match the given criteria.
New-SPManagedPath – Creates a new managed path for the given Web application for all host header site collections.
Remove-SPManagedPath – Deletes the specified managed path from the specified host header or Web application.
SPMetadataServiceApplication
Get-SPMetadataServiceApplication – Get a MetadataWebServiceApplication instance
New-SPMetadataServiceApplication – Create a Metadata Shared Service Application
Set-SPMetadataServiceApplication – Set properties on a Metadata Shared Service Application
SPMetadataServiceApplicationProxy
Get-SPMetadataServiceApplicationProxy – Get a MetadataWebServiceApplicationProxy instance
New-SPMetadataServiceApplicationProxy – Create proxy for remote or local Metadata shared service application
Set-SPMetadataServiceApplicationProxy – Update metadata proxy settings
SPMetadataWebServicePartitionData
Clear-SPMetadataWebServicePartitionData
Export-SPMetadataWebServicePartitionData
Import-SPMetadataWebServicePartitionData
SPMobileMessagingAccount
Get-SPMobileMessagingAccount – Retrieves mobile messaging accounts for the specified Web application.
Set-SPMobileMessagingAccount – Configures the specified mobile messaging account.
SPObaSolutionPackage
New-SPObaSolutionPackage
SPObjectSecurity
Get-SPObjectSecurity – Returns the security information for the specified service application.
SPParentFarmTrust
Get-SPParentFarmTrust
New-SPParentFarmTrust
Remove-SPParentFarmTrust
Set-SPParentFarmTrust
SPPassPhrase
Set-SPPassPhrase – Sets the Passphrase to a new value.
SPProcessAccount
Get-SPProcessAccount
SPProduct
Get-SPProduct – Returns a list of the SharePoint related products installed in the farm and the versions of all updates installed for each of them.
SPProfileServiceApplication
New-SPProfileServiceApplication
Set-SPProfileServiceApplication
SPProfileServiceApplicationProxy
New-SPProfileServiceApplicationProxy
Set-SPProfileServiceApplicationProxy
SPProfileServiceApplicationTenant
Add-SPProfileServiceApplicationTenant
Export-SPProfileServiceApplicationTenant
Import-SPProfileServiceApplicationTenant
Remove-SPProfileServiceApplicationTenant
Set-SPProfileServiceApplicationTenant
SPResourceSecurity
Initialize-SPResourceSecurity
SPSearchService
Get-SPSearchService – Returns a search service.
Set-SPSearchService – Sets properties of a search service.
SPSearchServiceInstance
Get-SPSearchServiceInstance – Returns an instance of a search service.
Set-SPSearchServiceInstance – Sets properties of a search service instance.
SPSecureStoreApplication
Get-SPSecureStoreApplication
New-SPSecureStoreApplication
Remove-SPSecureStoreApplication
Set-SPSecureStoreApplication
SPSecureStoreApplicationField
New-SPSecureStoreApplicationField
SPSecureStoreApplicationServerKey
Update-SPSecureStoreApplicationServerKey
SPSecureStoreCredentialMapping
Clear-SPSecureStoreCredentialMapping
Update-SPSecureStoreCredentialMapping
SPSecureStoreGroupCredentialMapping
Update-SPSecureStoreGroupCredentialMapping
SPSecureStoreMasterKey
Update-SPSecureStoreMasterKey
SPSecureStoreServiceApplication
New-SPSecureStoreServiceApplication
Set-SPSecureStoreServiceApplication
SPSecureStoreServiceApplicationProxy
New-SPSecureStoreServiceApplicationProxy
SPSecureStoreTargetApplication
New-SPSecureStoreTargetApplication
SPSecurityTokenService
Get-SPSecurityTokenService
SPServer
Get-SPServer – Returns the server(s) in the farm that match the given identity.
Rename-SPServer – Renames a server that is currently connected to the farm.
SPServiceApplication
Get-SPServiceApplication – Return the specified service application.
Grant-SPServiceApplication – Grants a user account access to the Service Application.
Publish-SPServiceApplication – Share the specified local Service Application outside the farm.
Remove-SPServiceApplication – Deletes the specified service application on the local server.
Revoke-SPServiceApplication – Revokes a user’s access to a service application.
Set-SPServiceApplication
Unpublish-SPServiceApplication – Stop sharing the specified service application outside the farm.
SPServiceApplicationProxy
Get-SPServiceApplicationProxy – Returns an instance of the specified Service Application Proxy.
Remove-SPServiceApplicationProxy – Delete the specified service application proxy.
SPServiceApplicationProxyGroup
Get-SPServiceApplicationProxyGroup – Returns the proxy group for the specified service application.
New-SPServiceApplicationProxyGroup – Creates a new service application proxy group.
Remove-SPServiceApplicationProxyGroup – Completely deletes the specified service application proxy group.
SPServiceApplicationProxyGroupMember
Add-SPServiceApplicationProxyGroupMember – Adds a member to the service application proxy group.
Remove-SPServiceApplicationProxyGroupMember – Removes one or more proxies from the specified service application proxy group.
SPServiceContext
Get-SPServiceContext
SPServiceEndpoint
Get-SPServiceEndpoint
Set-SPServiceEndpoint
SPServiceInstance
Get-SPServiceInstance – Returns the services instance for a specific server or the farm.
Start-SPServiceInstance – Starts the Service Instance for a Service on a specific server or the farm.
Stop-SPServiceInstance – Stops the Service Instance for a Service.
SPSessionStateService
Disable-SPSessionStateService
Enable-SPSessionStateService
Get-SPSessionStateService
Set-SPSessionStateService
SPSharedServiceApplicationInfo
Receive-SPSharedServiceApplicationInfo
SPSingleSignOn
Disable-SPSingleSignOn – Disables the SharePoint Single Sign On service
SPSingleSignOnDatabase
Upgrade-SPSingleSignOnDatabase – Upgrades the SSO 12 data to a Secure Store database
SPSite
Backup-SPSite – Performs a backup of a site collection.
Get-SPSite – Returns all site collections that match the given criteria.
New-SPSite – Creates a new site collection at the specified URL.
Remove-SPSite – Completely deletes an existing site collection and all sub-sites.
Restore-SPSite – Restores a site collection.
Set-SPSite – Configures the specified sites.
SPSiteAdministration
Get-SPSiteAdministration – Returns a site administration object which allows a farm administrator to view certain information about site collections they may not have access to.
Set-SPSiteAdministration – Allows farm administrators to configure any site collection.
SPSiteSubscription
Get-SPSiteSubscription – Returns the site subscription for the given URL or all site subscriptions in the local farm.
New-SPSiteSubscription – Creates a new site subscription.
Remove-SPSiteSubscription – Removes a site subscription along with all contained site collections and settings.
SPSiteSubscriptionConfig
Get-SPSiteSubscriptionConfig
Set-SPSiteSubscriptionConfig
SPSiteSubscriptionMetadataConfig
Get-SPSiteSubscriptionMetadataConfig
Remove-SPSiteSubscriptionMetadataConfig
Set-SPSiteSubscriptionMetadataConfig
SPSiteSubscriptionSettings
Export-SPSiteSubscriptionSettings
Import-SPSiteSubscriptionSettings
Remove-SPSiteSubscriptionSettings
SPSolution
Add-SPSolution
Get-SPSolution
Install-SPSolution
Remove-SPSolution
Uninstall-SPSolution
Update-SPSolution
SPSolutionDeploymentLock
Remove-SPSolutionDeploymentLock
SPStateServiceApplication
Get-SPStateServiceApplication
New-SPStateServiceApplication
Set-SPStateServiceApplication
SPStateServiceApplicationProxy
Get-SPStateServiceApplicationProxy
New-SPStateServiceApplicationProxy
Set-SPStateServiceApplicationProxy
SPStateServiceDatabase
Dismount-SPStateServiceDatabase
Get-SPStateServiceDatabase
Initialize-SPStateServiceDatabase
Mount-SPStateServiceDatabase
New-SPStateServiceDatabase
Remove-SPStateServiceDatabase
Resume-SPStateServiceDatabase
Set-SPStateServiceDatabase
Suspend-SPStateServiceDatabase
SPSubscriptionSettingsServiceApplication
New-SPSubscriptionSettingsServiceApplication
Set-SPSubscriptionSettingsServiceApplication
SPSubscriptionSettingsServiceApplicationProxy
New-SPSubscriptionSettingsServiceApplicationProxy
SPTaxonomySession
Get-SPTaxonomySession – Get a TaxonomySession instance
SPTimerJob
Disable-SPTimerJob
Enable-SPTimerJob
Get-SPTimerJob
Set-SPTimerJob
Start-SPTimerJob
SPTopologyWebServiceApplication
Get-SPTopologyWebServiceApplication
Set-SPTopologyWebServiceApplication
SPTopologyWebServiceProxy
Get-SPTopologyWebServiceProxy
Set-SPTopologyWebServiceProxy
SPUsageApplication
Get-SPUsageApplication
New-SPUsageApplication
Remove-SPUsageApplication
Set-SPUsageApplication
SPUsageDefinition
Get-SPUsageDefinition
Set-SPUsageDefinition
SPUsageLogFile
New-SPUsageLogFile
SPUsageService
Get-SPUsageService
Set-SPUsageService
SPUser
Get-SPUser – Returns the user(s) that match a given search criteria.
Move-SPUser – Migrates a user account in .
New-SPUser – Adds an existing user to a site with the designated permissions.
Remove-SPUser – Removes a user from a web site.
Set-SPUser – Configures properties on an existing user.
SPUserProfilePhotoStore
Update-SPUserProfilePhotoStore
SPUserSolution
Add-SPUserSolution
Get-SPUserSolution
Install-SPUserSolution
Remove-SPUserSolution
Uninstall-SPUserSolution
Update-SPUserSolution
SPVisioExternalData
Get-SPVisioExternalData – Returns the settings for external data connections for a Visio Service application.
Set-SPVisioExternalData
SPVisioPerformance
Get-SPVisioPerformance – Returns the Visio Graphics Services settings for the performance of a Visio Service application.
Set-SPVisioPerformance – Sets performance properties for a Visio Services application.
SPVisioSafeDataProvider
Get-SPVisioSafeDataProvider – Returns the settings of a safe data provider for a Visio Services application.
New-SPVisioSafeDataProvider – Adds a new data provider to a Visio Services application.
Remove-SPVisioSafeDataProvider – Removes a data provider from a Visio Services application.
Set-SPVisioSafeDataProvider – Specifies a description of a safe data provider for a Visio Services application.
SPVisioServiceApplication
Get-SPVisioServiceApplication – Returns properties of a Visio Services application or a collection of Visio Services applications.
New-SPVisioServiceApplication – Adds a new Visio Services application to a farm.
Remove-SPVisioServiceApplication – Removes a Visio Services application from a farm.
Set-SPVisioServiceApplication – Sets the ServiceApplicationPool property of a Visio Services application.
SPVisioServiceApplicationProxy
Get-SPVisioServiceApplicationProxy – Returns properties of a Visio Services application proxy or a collection of Visio Services application proxies.
New-SPVisioServiceApplicationProxy – Adds a new Visio Services application proxy to a farm.
Remove-SPVisioServiceApplicationProxy – Removes a Visio Services application proxy from a farm.
SPWeb
Export-SPWeb – Exports a site collection, Web application, list, or library.
Get-SPWeb – Returns all sub-sites that match the given criteria.
Import-SPWeb – Imports a site collection, Web application, list, or library.
New-SPWeb – Creates a new sub-site under any existing site collection.
Remove-SPWeb – Completely deletes the specified Web.
Set-SPWeb – Configures the specified sub-site.
SPWebAnalyticsServiceApplication
Get-SPWebAnalyticsServiceApplication – Returns the settings for a Web Analytics Service application.
New-SPWebAnalyticsServiceApplication – Adds a new Web Analytics Service application to the farm.
Set-SPWebAnalyticsServiceApplication – Sets properties of a Web Analytics Service application.
SPWebAnalyticsServiceApplicationProxy
New-SPWebAnalyticsServiceApplicationProxy – Adds a new Web Analytics Service application proxy to the farm.
SPWebApplication
Get-SPWebApplication – Returns all Web applications that match the given criteria.
New-SPWebApplication – Creates a new Web application within the local farm.
Remove-SPWebApplication – Deletes the specified Web application.
Set-SPWebApplication – Configure the specified Web application.
SPWebApplicationExtension
New-SPWebApplicationExtension – Creates a new zone instance for the Web application.
SPWebApplicationHttpThrottling
Disable-SPWebApplicationHttpThrottling
Enable-SPWebApplicationHttpThrottling
SPWebApplicationHttpThrottlingMonitor
Set-SPWebApplicationHttpThrottlingMonitor
SPWebApplicationHttpThrottlingMonitors
Get-SPWebApplicationHttpThrottlingMonitors
SPWebApplicationSiginRedirectUrl
Set-SPWebApplicationSiginRedirectUrl
SPWebPartPack
Get-SPWebPartPack – Return the Web part packages installed for the specified scope.
Install-SPWebPartPack – Installs the specified Web part package to the specified location.
Uninstall-SPWebPartPack – Uninstall the specified Web part package.
SPWebTemplate
Get-SPWebTemplate – Displays all globally installed site templates that match the given identity.
Install-SPWebTemplate – Installs the given site template.
Set-SPWebTemplate – Changes the title and description of an installed site template.
Uninstall-SPWebTemplate – Uninstall the given site template.
SPWordConversionServiceApplication
New-SPWordConversionServiceApplication – Creates a new service application.
Set-SPWordConversionServiceApplication – Sets parameters on a service application.
SPWordConversionServiceApplicationProxy
New-SPWordConversionServiceApplicationProxy – Creates a new service application proxy.
SPWorkflowConfig
Get-SPWorkflowConfig – Returns workflow settings for the specified Web application.
Set-SPWorkflowConfig – Configures the workflow settings for the specified Web application.

Export Operation in SharePoint2010 using Powershell:
==========================================================
Export-SPWeb -Identity <SiteURL> -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions]
[-NoFileCompression] [-GradualDelete] [-Verbose]
Ex: Export-SPWeb http://Server1:5000/sites/Sc1 -ItemUrl "Lists/list1" -Path E:\Sc1\list1.cmp

Import Operation SharePoint2010 using Powershell:
Import-SPWeb -Identity  <SiteURL>  -Path <ExportFileName>  [-Force] [-NoFileCompression] [-Verbose]
EX:Import-SPWeb -Identity http://Server1:5000/sites/Sc1/ -path "\\server1\sc1\list1.cmp" -IncludeUserSecurity
======================================================
WSP BackUp(Power Shell) in SharePoint2010 using Powershell
(Get-SPSolution web.Dew.Deployment.wsp).Solutionfile.Saveas("E:\Backup\web.site.Deployment.wsp_03092012")
================================================================= Merge URL Logs from more than one server using power Shell command:
Merge-SPLogFile –Path "E:\Logs\MergedLog.log" –Overwrite –StartTime "1/3/2013 14:25" –EndTime "1/3/2013 14:40
================================================================= Create Site Collection in SharePoint2010 using Powershell:
STSADM.EXE -o createsite -url http://Server1:5000/sites/Sc1/ -ownerlogin domain\yogesh -owneremailyogesh@test.com
New-SPSite -Url "http://Server1:5000/sites/Sc1/" -OwnerAlias "domain\yogesh" -OwnerEmail "yogesh@test.com"
---Retruns the sitecollection URL
============================================================== Create Content Database in SharePoint2010 using Powershell : use farmadmin account
New-SPContentDatabase -Name WSS_Content_sc1 -WebApplication "http://Server1:5000/"
Returns :
Id               : c418cee5-5042-4a07-8217-eda7a0d9df43
Name             : WSS_Content_sc1
WebApplication   : SPWebApplication Name=sc1
Server           : server1
CurrentSiteCount : 0
===============================================================
The Install-SPWebPartPack cmdlet installs the Web Part package, at the LiteralPath parameter location, in the local farm. The Web Part package can be installed in a specific Web application by using the WebApplication parameter. If a Web application is not specified, the Web Part package is installed in all Web applications
EX:
Install-SPWebPartPack "MyCustomWebPartPack" -LiteralPath "c:/mywebpart.wpp" -GlobalInstall
Uninstall-SPWebPartPack  "mypart.wpp" –WebApplication http://portal
This example uninstalls mypart.wpp to from the Web application 
http://portal
Get-SPWebPartPack –WebApplication http://portal | Uninstall-SPWebPartPack
This example uninstalls all Web part packages from the Web application 
http://portal.
=============================================================== 
Backup and restore
Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} -Item <WebApplicationName> [-Verbose]
=============================================================== 
Move:
Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase <DestinationContentDb>
will let you the database of site collection for orphened sc's
=============================================================== Mount-SPContentDatabase “MyDatabase” -DatabaseServer "MyServer" -WebApplicationhttp://sitename
Mount-SPContentDatabase -name <NewContentDatabase> -DatabaseServer <DatabaseServer> -WebApplication <WebappUrl> -confirm:$false
===========================================================
How to get site collections usage size under webapplication:
Get-SPWebApplication http://Webappname | Get-SPSiteAdministration -Limit All | select Url, DiskUsed | Export-CSV C:\WebappnameSiteCollectionStorage.csv
============================================================
How to get All the site collections under webapplication
Get-SPWebapplication http://webapplicationname | Get-SPSite -Limit All | Export-CSV C:\SiteCollectioninWebapp.csv
==============================================================
How to get sitecollections usage size of entire  farm
Get-SPSiteAdministration -Limit All | select Url, DiskUsed | Export-CSV C:\farmSiteCollectionStorageused.csv
================================================================
How to get Timer Job history using Powershell
$TJHistory = Get-SPTimerJob | Where-Object {$_.name -eq "MyTimer_createfile"} | Export-CSV C:\MyTimer_createfile.csv
$TJHistory = Get-SPTimerJob | Where-Object {$_.name -eq "Mytimer_RegisterUsers"} | Export-CSV C:\Mytimer_RegisterUsers.csv
$TJHistory = Get-SPTimerJob | Where-Object {$_.name -eq "MyTimer_DeRegisterUsers"} | Export-CSV C:\MyTimer_DeRegisterUsers.csv


Tuesday, 11 February 2014

PowerShell - Update default list view by adding 2 columns for all site under all site collection under specified Managed Path

PowerShell - Update default list view by adding 2 columns for all site under all site collection under specified Managed Path:-

<#
.SYNOPSIS
   <A brief description of the script>
.DESCRIPTION
   <A detailed description of the script>
.PARAMETER <paramName>
   <Description of script parameter>
.EXAMPLE
   <An example of using the script>
#>

$UrlDochubWebApp = Read-Host "Enter destination web app url"

$FieldPropetyInternalname = "Property"; # column 1
$FieldTitleInternalname = "Title"; # Column 2

#Loading Snap in for Microsoft.Sharepoint.Powershell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{

Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}

function updateView($list)
{
$View = $list.DefaultView;
$ViewFields = $View.ViewFields;
try
{
if(!$ViewFields.Exists($FieldTitleInternalname))
{
$ViewFields.add($FieldTitleInternalname);
$ViewFields.MoveFieldTo($FieldTitleInternalname,2);
}
if(!$ViewFields.Exists($FieldPropetyInternalname))
{
$View.ViewFields.add($FieldPropetyInternalname);
$View.ViewFields.MoveFieldTo($FieldPropetyInternalname,4);
}
$View.update();
}
catch [System.Exception]
{
Write-Host $_;
}

}

function updateLIbraries()
{
 $Webapplication =GEt-SPWebAPplication $UrlDochubWebApp


$AllLibraryNames = New-Object "System.Collections.Specialized.StringCollection"
$AllLibraryNames.Add("Library1") | Out-Null;
$AllLibraryNames.Add("Library2") | Out-Null ;
$AllLibraryNames.Add("Library3") | Out-Null ;
$AllLibraryNames.Add("LIbrary4") | Out-Null ;
if($Webapplication -ne $null)
{
$Allsites = $Webapplication.Sites
foreach($Site in $Allsites)
{
$siteUrl = $Site.Url;

foreach($web in $site.AllWebs)
{
try
{
$WebURl = $web.Url;
if(($web.Url.toLOwer() -match ("/debt/"))) # Condition to check managed path
{
$WebURl = $web.Url;
$allLists = $web.Lists;
$alllistsCount = $allLists.Count;
for($counter = 0;$Counter -lt $alllistsCount;$counter++)
{
$list = $allLists[$counter];
$ListTitle = $list.Title
$LIstITemCount = $list.ItemCount;
if(($list.BaseType -eq "DocumentLibrary") -and ($AllLibraryNames.Contains("$ListTitle") ) )
{
updateView $list;
}
}
Write-Host "Updated for $WebURl";
}
}
finally
{
$web.Dispose();
}
}
}
}

}

updateLIbraries;



PowerShell - Extract all files modified within a date range in a web application in to CSV file

PowerShell - Extract all files modified within a date range in a web application in to CSV file :-

$UrlDochubWebApp = Read-Host "Enter destination web app url" # http://<site url>
$fromDate = Read-Host "Enter From Date (Format YYYY-MM-DD)"; # files modified start date
$toDate = Read-Host "Enter To Date (Format YYYY-MM-DD)"; # file modified end date
$SiteCollFilePath = Read-Host "Enter SIte collection csv details Path(folder path)"
#Loading Snap in for Microsoft.Sharepoint.Powershell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{

Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}
$Webapplication =GEt-SPWebAPplication $UrlDochubWebApp
$SiteCollFilePath = "$SiteCollFilePath\ItemsCreated_$(get-date -format MMddyyHHmmss).csv";

$AllLibraryNames = New-Object "System.Collections.Specialized.StringCollection"
$AllLibraryNames.Add("library1") | Out-Null;
$AllLibraryNames.Add("library2") | Out-Null ;
$AllLibraryNames.Add("library3") | Out-Null ;
$AllLibraryNames.Add("library4") | Out-Null ;
$AllLibraryNames.Add("library5") | Out-Null ;
$dtToDate = Get-Date -Date $toDate
$dtFromDate = $dtFromDate.ToString("yyyy-MM-ddThh:mm:ss");
$dtToDate = $dtToDate.ToString("yyyy-MM-ddThh:mm:ss");
$strToBeInserted = "Site URL,Web Url,FileName,FileUrl,Created By,Created";

function LogData()
{
 Param ([string]$logstring)
Add-content $SiteCollFilePath -value $logstring
}

LogData $strToBeInserted;
if($Webapplication -ne $null)
{
$Allsites = $Webapplication.Sites
foreach($Site in $Allsites)
{
$siteUrl = $Site.Url;

foreach($web in $site.AllWebs)
{
try
{
$WebURl = $web.Url;
if(-not($web.Url.toLOwer() -match ("/scrapsite"))) # Condition to exclude a subsite named scrapsite..
{
foreach($list in $web.Lists)
{
$ListTitle = $list.Title
$LIstITemCount = $list.ItemCount;
if(($list.BaseType -eq "DocumentLibrary") -and ($AllLibraryNames.Contains("$ListTitle") ) -and ($LIstITemCount -gt 0))
{
$spQueryFilesAdded = New-Object Microsoft.SharePoint.SPQuery
$spQueryFilesAdded.Query="<Where><And><Geq><FieldRef Name='Created' /><Value Type='DateTime'>$dtFromDate</Value></Geq><Leq><FieldRef Name='Created' /><Value Type='DateTime'>$dtToDate</Value></Leq></And></Where>";
$spQueryFilesAdded.ViewAttributes="Scope='Recursive'";
$ItemsAdded = $list.getItems($spQueryFilesAdded);
if( $ItemsAdded.Count -gt 0)
{
foreach($item in $ItemsAdded)
{
$itemCreated = $item["Created"];
$itemCreatedBY = $item["Author"].ToString().Split("#".ToCharArray())[1];
$spFIle = $item.File;
$filename = $spFIle.Name;
$fileURl = $spFIle.URl;

$strToBeInserted = "$siteUrl,$WebURl,$filename,$fileURl,$itemCreatedBY,$itemCreated";

LogData $strToBeInserted;
}
}

}
}
}
}
finally
{
$web.Dispose();
}
}
}
}


PowerShell - Bulk Solution Deployment

PowerShell - Bulk Solution Deployment <Add & Install Solution> :-

#Loading Snap in for Microsoft.Sharepoint.Powershell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}

if ($snapin -eq $null)
{

Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}

$Path  = Read-HOst "Enter network folder path for WSPs (e.g F:\WSPs)"
#"F:\WSPs"
$WebApp = Read-Host "Enter Web Application URL (e.g http://<site URL>/)"
#"http://<Site URL>/"
Write-Host "Adding Solutions to solution store..." -ForegroundColor Yellow

Add-SPSolution -LiteralPath $Path\WebTemplates.Core.Features.wsp
Add-SPSolution -LiteralPath $Path\TEMPLATE.wsp
Add-SPSolution -LiteralPath $Path\Working.Site.wsp
Add-SPSolution -LiteralPath $Path\Presentation.wsp
Add-SPSolution -LiteralPath $Path\Master.wsp
Add-SPSolution -LiteralPath $Path\MasterpageExtension.wsp
Add-SPSolution -LiteralPath $Path\ContentTypes.wsp
Add-SPSolution -LiteralPath $Path\DocumentPromotion.wsp



Write-Host "Solutions uploaded to solution store !!!" -ForegroundColor Green

Write-Host "Deploying Solutions..." -ForegroundColor Yellow

Install-SPSolution -Identity WebTemplates.Core.Features.wsp -GacDeployment
Install-SPSolution -Identity TEMPLATE.wsp -GacDeployment
Install-SPSolution -Identity Working.Site.wsp -GacDeployment
Install-SPSolution -Identity Presentation.wsp -GacDeployment -Webapplication $WebApp
Install-SPSolution -Identity Master.wsp -GacDeployment
Install-SPSolution -Identity MasterpageExtension.wsp -GacDeployment
Install-SPSolution -Identity ContentTypes.wsp -GacDeployment
Install-SPSolution -Identity DocumentPromotion.wsp -GacDeployment


Write-Host "Solutions Deployed !!!" -ForegroundColor Green

PowerShell - Read data from SQL Table and Insert in to SharePoint List

PowerShell - Read data from SQL Table and Insert in to SharePoint List:-

#Gets the Powershell snapin
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
#Checking the snapin
if ($snapin -eq $null)
{

Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}

#Creating sql connection
WRite-HOst "Moving XREF information to Sharepoint list"
$con = New-Object System.Data.SqlClient.SqlConnection
#Providing sql connection string
    $con.ConnectionString = "Server=<Server Name>;Database<Database Name>;Integrated Security=false;user id=<User Id>;password=<Password>";
    # Opening the connection
    $con.open()
    #Creating new sql command
    $cmd = New-Object System.Data.SqlClient.SqlCommand
    #Providing query to command
    $cmd.CommandText = "select lm.LOAN as Loan,eg.XREF as Xref from LNMAST LM,egeneral eg WHERE lm.LOAN = eg.LOAN and XREF is not null and XREF != '' order by lm.LOAN asc"
    #Providing connection to command
    $cmd.Connection = $con
 
    # Create SqlDataAdapter object and set the command
    $da = New-Object System.Data.SqlClient.SqlDataAdapter
    $da.SelectCommand = $cmd

    # Create and fill the DataSet object
    $LMSDataTable = New-Object System.Data.DataTable
    $da.Fill($LMSDataTable)
    #Closing the sql connection
    if($con -ne $null)
    {
        $con.close();
    }
 
    [Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges(

    {

 #Getting the web site
    $DebtWeb=Get-SPWeb "http://<Machine Name>:8800/<Subsite>/"
    #Getting the List
    $mylist = $DebtWeb.Lists["Mapping"] # List Name
 
    $Items = $mylist.GetItems()
    $Items | ForEach-Object{$mylist.GetItemById($_.Id).Delete()}
    $mylist.Update()
 
    #looping lms datatable
    foreach ($row in $LMSDataTable.Rows) {
 
 
    #adding new item in list
 
    $newItem = $mylist.Items.Add()
    #assigning values to list columns
    $newItem["Title"] = $($row["Loan"])
    $newItem["LoanNumber"] = $($row["Loan"])
    $newItem["XrefNumber"] = $($row["Xref"])
    #updating list item
    $newItem.Update()
 


    }

   }

)

 

    #End
    WRite-HOst "XREF information moved to Sharepoint list"

Create Managed Path using PowerShell

Create Managed Path using PowerShell

$Webappname = Read-Host "Enter web application URL"
#"http://testsite.com"

$mPathEquity = "equity" # manged Path 1
$mPathDebt = "debt" # manged Path 2

function Create-SPManagedPath
{
param ($webApplicationUrl, $managedPathName)
$managedPath = Get-SPManagedPath -WebApplication $webApplicationUrl -Identity $managedPathName -ErrorAction SilentlyContinue
if ($managedPath -ne $null)
{
Write-Host "Managed path $managedPathName already exists."
return
}
Try
{
Write-Host "Creating managed path $managedPathName ..."
New-SPManagedPath –RelativeURL $managedPathName -WebApplication $webApplicationUrl

Write-Host "Managed path $managedPathName created sucessfully" -foregroundcolor Green
}
catch [Exception]
{
Write-Host   $_.Exception.ToString()
}
}

 Write-Host "Creating Managed Paths" -foregroundcolor Yellow
 Create-SPManagedPath  $Webappname $mPathDebt
 Create-SPManagedPath  $Webappname $mPathEquity
 Write-Host "Completed Creating Managed Paths" -foregroundcolor Green

Wednesday, 29 January 2014

How to use Status Bar in SharePoint 2010?

How to use Status Bar in SharePoint 2010?


In SharePoint 2010, Status bar is used to display information/warnings without disturbing user with Javascript alerts. Please don't think it is Browser's Status bar. It's a special information bar which displays below ribbon/top bar when invoked. No Server side code or manual setup required to enable status bar. The required functions are bundled in SP.UI.Status class that defined in SP.Js/SP.Debug.Js and it's included in SharePoint master page. So no need to include Js manualy to use Status bar.

Well, Javascripts alerts are not helpful to display HTML content, images, links. Where Status bar accepts HTML content and can be invoked just with Javascript.

SP.UI.Status Functions
The SP.UI.Status class has 6 functions. They are
  1. SP.UI.Status.addStatus(strMessageHeading, strHTMLContent, boolAtBegining) This function used to display specified content in Status bar. The parameters are self explanatory. boolAtBegining parameter specifies whether this content should be shown at First(just like to give priority) and it's useful when more than one status messages invoked.
  2. SP.UI.Status.appendStatus(strStatusID, strHTMLContent) This function appends HTML content with an existing status bar content.
  3. SP.UI.Status.updateStatus(strStatusID, strHTMLContent) This function updates/replaces existing HTML content with given HTML content.
  4. SP.UI.Status.setStatusPriColor(strStatusID, strColor) This function sets/changes the color of status bar. Only four colors[red, yellow, green, blue] are allowed which specifies the priority. Red - High Priority, yellow, green, blue - Low Priority. When two colors applied on same status bar then High priority color will be considered by SharePoint.
  5. SP.UI.Status.removeStatus(strStatusID) This function removes the specific Status bar.
  6. SP.UI.Status.removeAllStatus(boolHideStatus) This function removes all Messages. If the boolHideStatus passed as true then it'll hide all status bar with messages. Otherwise it'll hide only Status Message but a thin status bar will remains in place.
How to add code?
Follow the steps to add Content Editor Webpart and add HTML/Javascript Code.
  1. Site Actions -> Edit Page (or Edit page Icon on top bar)
  2. Click Editing Tools(Tab) -> Insert (Tab) -> Webpart
  3. Select Media and Content (Section) -> Content Editor.
  4. Select Content Editor Webpart (Black triangle on top right of the webpart)-> Edit Webpart.
  5. Editing Tools (Tab) -> Format Text -> HTML -> Edit HTML Source.
Edit HTML Content of Content Editor WebPart
Demo Code
 <Script type="text/javascript">
var
 strStatusID;function showInfo()
{
  strStatusID = SP.UI.Status.addStatus(
"Information : ", "<img src='/_Layouts/Images/STS_ListItem_43216.gif' align='absmiddle'> <font color='#AA0000'>Registration process <i>completed</i>.</font>", true);
  SP.UI.Status.setStatusPriColor(strStatusID, 
"yellow");
}

function
 appendInfo()
{
  SP.UI.Status.appendStatus(strStatusID, 
" Next : ", " <b>You can <a href='Login.aspx'>Login Now</a>", false);
  SP.UI.Status.setStatusPriColor(strStatusID, 
"blue");
}
function updateInfo()
{
  SP.UI.Status.updateStatus(strStatusID, 
"Status Update: This content updated with " + strStatusID + " using updateStatus");
  SP.UI.Status.setStatusPriColor(strStatusID, 
"green");
}
function updateInfoRed()
{
  SP.UI.Status.setStatusPriColor(strStatusID, 
"red");
}
function removeInfo()
{
  SP.UI.Status.removeStatus(strStatusID);
}
function removeAllInfos()
{
  SP.UI.Status.removeAllStatus(
true);
}
</Script>

<
div class="ms-toolpanefooter">
  <
input type="button" onclick="Javascript:showInfo();" value="Show Info" class="UserButton" /> 
  <
input type="button" onclick="Javascript:appendInfo()" value="Append Info" class="UserButton" />   <input type="button" onclick="Javascript:updateInfo()"value="Update Info" class="UserButton" /> 
  <
input type="button" onClick="Javascript:updateInfoRed()" value="Make Red" class="UserButton" />   <input type="button" onClick="Javascript:removeInfo()" value="Remove Info" class="UserButton"/>
  
<input type="button" onClick="Javascript:removeAllInfos()" value="Remove All Infos" class="UserButton"/>
</
div>
Add Status
Append Status
Update Status
Change Color of Status Bar
Remove Status


Status bar is used at client side(browser) to display message. If you want to fetch data from status bar then use a hidden variable and assign same value which u pass to status bar via Java Script.
If you want to pass data from Server side to client side then

Add the below function in Javascript.
function showInfo(strMessage)
{
strStatusID = SP.UI.Status.addStatus(strMessage, true);
SP.UI.Status.setStatusPriColor(strStatusID, "yellow");
}
Add a label "lblScripter"
Then in Server Side Code add
lblScripter.Text = "<Script language='javascript;>showInfo('" + strYourMessage + "');</script>";
This will invoke the Javascript and show the statusbar.