I need to disable access to a SharePoint application between 6 PM and 7 AM. SharePoint 2007 doesn't seem to have an out-of-the-box "maintenance mode," so I'm looking for a solution. Presently someone moves users out of a security group to limit access to the application, so in the very least, automating that process would work.
Is there a PowerShell script or SharePoint feature or something I can add to my server to enable a maintenance mode for an application? Perhaps sample code for an SPJobDefinition?
you could automate the removal of users in a bat file with the
stsadm -o userrole -url <url> -userlogin <DOMAIN\name> -role <role name> [-add] [-delete]
Check out this link for a way to enumerate sharepoint with Powershell:
link
An IIS method is to restrict access by IP address. I've used that before successfully and it should be quite easy to write a PowerShell script to do it or use the IIS admin scripts.
I'm not aware of SharePoint methods that do this. There is the quiescefarm stsadm command but that applies to InfoPath forms only.
If you want to make the site completely inaccessible, you could write a script to add an app_offline.htm file to the SharePoint site's root directory.
This would prevent anybody from accessing the site, so it might not be ideal if you need to allow admins to login. But it might be a solution if you have a backdoor.
Related
I have a farm solution wsp which I want to add and deploy on a client's SharePoint farm.
Now I don't have remote access to this SharePoint machine but do have full admin rights to its central admin and related site collection, and can open the central admin and all sites through my machine.
Now as per my knowledge a farm solution is added to the SharePoint farm and not to the site collection, but I could not find any screen in central admin from which I can add my solution.
This is the case with both SharePoint 2010 and SharePoint 2013 servers.
What are the possibilities?
Basically, it sounds like you need to add and deploy a farm solution only using central admin? I don't think that is possible. If you look step one from MSDN
Adding: A solution package is added by a farm administrator to the farm's solution store, which is in the farm's configuration database. This is done either with the SharePoint Management Shell (or with the object model). It cannot be done in Central Administration.
You can't do this through web interface.
If you have full admin rights - you can use Remote PowerShell. But this require some setup on server. You can read this article about this: http://blog.incworx.com/blog/nik-brendlers-blog/administer-your-sharepoint-farm-remotely-with-powershell
Working with an mvc4 application that runs in IIS 7.5, the site though exist once on disk, has over a 100 url's pointing to it. This is because the site displays content based on the country that needs to access it.
Due to this, the site can have over a 100 bindings, which is very hard to manage.
I am looking to automate the creating of the site in IIS using powershell. I would run this during each deployment to ensure each of my environments are identical (dev, qa, production).
The powershell script would delete the site and recreate it, applying bindings, configuring it etc. I am a newbie to powershell so I would appreciate any help with this.
You should be able to use the PowerShell IIS Administrative Cmdlets. I show how to automate creating and deleting web applications using them on my blog that should get you started.
I have a script I use when creating a website and AppPool in IIS 7+ (under .net4, Integrated pipeline, etc) and thought you might find it useful as its a bit simpler than some of the other answers. It will delete the site and replace it if it already exists making it good in continuous integration scenarios.
Use it as so:
CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path]
If you are reinstalling the site, you will need to stop it first. That is done as so:
StopSite.ps1 [WebsiteName] [AppPoolName]
you gan grab the scripts from my gist
There is an IIS provider for PowerShell which you can use to manage IIS from PowerShell.
Take a look at the available cmdlets.
I have developed a site, took a back up on the development site. I have created a empty site on the live environment. I have restored the blank site from the backup.
I need to change some parameters of the webpart. could anybody suggest me what those list of parameters as I have the following error.
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.
Many Thanks
Backup/restore in SharePoint doesn't include custom solutions (wsp file) which means you need to deploy them manually using stsadm tool. See example below:
stsadm -o deploysolution -name webparts.wsp -allowgacdeployment -immediate -url http://localhost
Is there a command to delete the entire web application (database, iis sites etc) using the Sharepoint admin tool?
I know the same can be done in the central admin, but i have a need to automate this process as we want our build servers to rebuild the sharepoint site from scratch each night.
You should be able to do that with the stsadm unextendvs operation.
stsadm -o unextendvs -url http://MySite -deletecontent -deleteiissites
In addition to the unextendvs stsadm command you will need to drop the table in SQL. Using this command to remove the content database will remove the link from the content database to the SharePoint web application, but I don't think it will actually drop the SQL table.
So if you are running this every night be sure to either re-use the same content database or also script the table drop to ensure your SQL environment does not end up with abandoned tables.
Is it possible to create a user with permissions of both a local administrator and NETWORK SERVICE?
I've got a Sharepoint timer job which runs stsadm for which it needs local administrator permissions. On the other hand temer jobs are also used by other services which need NETWORK SERVICE permissions and those to sets of permissions only overlap, so I need a user with the "sum" of the permissions to run OWSTIMER under.
(I know that most of the operations you can perform with stsadm sharepoint administration API can be used, by in my case it is the operation which moves a site collection between content databases for which there seems to be no API equivalent).
I recommend always using domain accounts - SharePoint works best on servers connected to an Active Directory server. For production environments a best practice is using a least privilege account. I always create the following domain account dedicated to SharePoint services:
DOM\spservice
You do not need to grant any special privileges to this account as SharePoint will automatically do this for you when you specify the account during setup.
I can't help you with the user permissions (Lars hit the important points), but I wanted to share some information that may be of use.
You mentioned that you're trying to move site collections between content databases and haven't found an API the can be leveraged. Have you looked into SharePoint's Content Deployment API (also know as the PRIME API) to see if it can assist? The types of which I'm speaking are located in the Microsoft.SharePoint.Deployment namespace, and they provide you with mechanisms to export (via SPExport) site collections as CAB files and then import them (via SPImport).
SharePoint leverages types in this namespace for its own content deployment paths and jobs (in MOSS); it's also the API that is leveraged by the STSADM.EXE executable for export (STSADM.EXE -o export) and complementary import operations. For that matter, it's also used by SharePoint Designer for it's site "backup" and "restore" operations.
For an example of how this API can be leveraged, check out the SharePoint Content Deployment Wizard tool on CodePlex (http://www.codeplex.com/SPDeploymentWizard).
I hope this gives you a potential alternative to shelling out to a command line in your timer job!