Wednesday, March 28, 2012

SharePoint 2007 - Update multiple Site Collections quota values

Out of the box SharePoint 2007 does not offer an automated way to modify existing site collections with a quota value. For example if you have a quota "Extranet" with a size limit of 3GB that's been applied to 1000 sites currently there is no method to update this value on batch


However using the "SharePoint Administration Toolkit" you can run the following command


The following would update all the sites using the quota extranet with the new value


  • stsadm –o updatequota –quotaname Extranet

The following would update all the sites using the quota extranet with the new value but only that are contained in WSS_Content_001 


  • stsadm –o updatequota –quotaname Extranet -contentdb WSS_Content_001

For more examples follow this link 
http://technet.microsoft.com/en-us/library/ee449569(office.12).aspx


Saturday, March 10, 2012

SharePoint - Script to copy a files to SharePoint Library


Recently I was asked to automate a file copy from windows (UNC) into a SharePoint directory.  There are limitations with this especially with windows 7 and Server 2008 but luckily my requirement was from a Windows 2003 server to SharePoint 2010. You need to make sure you can view the "Explorer View" for this to work.


I used this simple DOS script, utilising  PUSHD (connects a the last free network drive) and POPD (release network drive).


rem $echo off
rem ************
set REPORT="d:\Sharepointcopy\InsiteSharepoint2010.log"
echo %date% %time% >> %REPORT%
pushd "\\contoso.com\Documents" >> %REPORT%
copy d:\*.xml /Y z:\ >> %REPORT%
popd 
echo %date% %time% >> %REPORT%
echo *Finished*>> %REPORT%



Friday, March 2, 2012

SharePoint 2010 - Powershell Installation Script

Following is a script I used for install 2010 onto farm - really simple - installs SharePoint 2010 , goes thorough initial wizard sets up CA on port 2222, installs basic features and services and then disables loopback.
Before running update the parameters in red




# Execute setup.exe with the setupfarmsilent xml to install SharePoint
#Write-Host "Installing SharePoint 2010 Quietly"
#& ‘C:\install\sp2010i\setup.exe’ ‘/config’ ‘C:\install\config.xml’ | out-null
# Include the SharePoint cmdlets
Write-Host "Loading SharePoint 2010 PowerShell cmdlets"
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Set the farm variables
Write-Host "Setting SharePoint 2010 Farm variables"
$sp_cfdatabasename = "SP2010_Config"
$sp_cadatabasename = "SP2010_Admin_Content"
$sp_databaseserver = "<add databaseserver>"
$sp_passphrase = (ConvertTo-SecureString "<add passphrase>" -AsPlainText -force)
$sp_password = (ConvertTo-SecureString "<add password>" -AsPlainText -force)
$sp_username = "<add username>"


# Clean up the credentials
$sp_credentials = New-Object System.Management.Automation.PsCredential $sp_username,$sp_password
# Execute the config wizard
Write-Host "Add configuration and administration databases"
New-SPConfigurationDatabase -DatabaseName $sp_cfdatabasename -DatabaseServer $sp_databaseserver -AdministrationContentDatabaseName $sp_cadatabasename -Passphrase $sp_passphrase -FarmCredentials $sp_credentials
# Provision a Central Administration Site
Write-Host "Add Central Administration"
New-SPCentralAdministration -Port 2222 -WindowsAuthProvider "NTLM"
# Install all of the help files within Central Admin
Write-Host "Installation of Help files"
Install-SPApplicationContent
# Secure the files and registry entries on the server 
Write-Host "Resource security"
Initialize-SPResourceSecurity
# to install the features on the server. 
Write-Host "Installation of features"
Install-SPFeature -AllExistingFeatures
# to install and and then provision the services onto the farm.
Install-SPService
# Disable the loopback check, run this command from PowerShell.
Write-Host "DisableLoopbackCheck registry key"
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck"  -value "1" -PropertyType dword
Write-Host "Installation script is complete"