The magic of Powershell lies in executing complex queries in a single line which might need many clicks from an User Interface. Below are a couple of one line codes in PowerShell for SharePoint.
1.What is the SharePoint Version
(Get-SPFarm).BuildVersion
Note: 15 means SharePoint 2013,14 for SharePoint 2010,12 for MOSS
3. Get the domain name that hosts apps in the entire farm
Get-SPAppDomain
4. Display all the managed accounts in the farm
Get-SPManagedAccount
5. Returns all servers in the local farm with SharePoint installed excluding Exchange and non Application server.
Get-SPServer | Where{$_.Role -ne "Invalid"} |sort Address
5. Get the total number of site count hosted in each content database in Farm. Returns the display in HTML format stored at c:\getDBSitecount.html"
Get-SPContentDatabase | ConvertTo- Html -Property Name,WebApplication, CurrentSiteCount|Out-File -FilePath C:\getDBSitecount.html
5. List the timer job running monthly and show the output in gridview
Get-SPTimerJob|?{$_.Schedule -like "month*"}|SELECT Name,Decription,Schedule|OUT- GRIDVIEW
Reference:
http://sharepoint.stackexchange.com/questions/26471/get-all-the-machines-in-a-sharepoint-farm
1.What is the SharePoint Version
(Get-SPFarm).BuildVersion
Note: 15 means SharePoint 2013,14 for SharePoint 2010,12 for MOSS
3. Get the domain name that hosts apps in the entire farm
Get-SPAppDomain
4. Display all the managed accounts in the farm
Get-SPManagedAccount
5. Returns all servers in the local farm with SharePoint installed excluding Exchange and non Application server.
Get-SPServer | Where{$_.Role -ne "Invalid"} |sort Address
5. Get the total number of site count hosted in each content database in Farm. Returns the display in HTML format stored at c:\getDBSitecount.html"
Get-SPContentDatabase | ConvertTo-
5. List the timer job running monthly and show the output in gridview
Get-SPTimerJob|?{$_.Schedule -like "month*"}|SELECT Name,Decription,Schedule|OUT-
Reference:
http://sharepoint.stackexchange.com/questions/26471/get-all-the-machines-in-a-sharepoint-farm
No comments:
Post a Comment