views:

393

answers:

3

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?

+1  A: 

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.

Alex Angas
+1  A: 

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

Colin
How would I loop through all the users in a group?
Robert S.
See edit i just added
Colin
+1  A: 

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.

Jeremy Kratz