Url for DocIDs

Posted: 16th January 2012 by JR52MAR in Microsoft
Number of View: 32

I can never remember how to do a URL for a DocID with BRAIN-197-3 or any other DocID for that matter, well here it is.

http://intranet.braindumpblog.co.uk/_layouts/DocIdRedir.aspx?ID=BRAIN-197-3

 

Number of View: 35

Now I needed to create the Site….. again keeping it simple and standard.

$DeptSiteName = Read-Host “Enter the Department Site Name”

$DeptSiteURL = “https://intranet.braindumplblog.com/en/Departments/$DeptSiteName”

$DeptSiteDescription = read-host “Enter brief description of site here”

$DeptSiteTemplate = “BLANKINTERNET#0″

New-SPWeb -Url $DeptSiteURL -Name $DeptSiteName -Template $DeptSiteTemplate -Description $DeptSiteDescription

so i saved the file and then when i run the ps1 file it asked me for the Department Site name, I entered TESTING which is the same thing i entered in Part One

The site was created….. right i better add some permissions, but that will have to wait till later. ;-)

Number of View: 54

As you can probably tell from the vast number of SharePoint Blog posts lately, I have been working on a SharePoint project. We have just launched a new intranet using SharePoint 2010 and we are expecting a large number of publishing sites requests from the internal departments. As part of the governance framework, we have created standard groups for each site type and these groups are to be managed within AD and not SharePoint. We also have deployed the SharePoint Servers to the root domain and all the users are in child domains. We have variations applied, a challenging infrastructure design also…. so this was not going to be easy.

My High level approach was taking me down the following phases and requirements (and over the next few blogs will cover each one in detail)

  • Creation of the AD Groups in the ROOT and CHILD domains, and wanted to standardise as much information as possible. – Part One
  • Creation of the Site itself – Part Two
  • Creation of the SharePoint Groups, again standardising as much information as possible – Part Three
  • Add the AD Groups into the SharePoint Groups and assign the site permissions – Part Four
  • Nest the CHILD Domain Groups into the ROOT Domain Groups as all security is controlled by the ROOT Domain (we plan to add more child domains in soon) – Part Five
  • Change the Master Page in all variations of the site to the custom page. – Part Six

Before I start…. I am not a master in powershell and in fact have only just started to explore it…. but i am impressed!

Ok so here goes.

Script 1 – Creation of the AD Groups in the ROOT and CHILD Domains

Our governance framework decreed that all site groups would be called the same (the only difference would be the Dept Site Name, so i thought about using a variable for this. I wanted to create four domain local security groups in the ROOT Domain and three global security groups in the CHILD domain. So here are the groups I will create $DeptSiteName would be the variable.
CHILD Domain Groups
GLS-CHILD-$DeptSiteName-Owners
GLS-CHILD-$DeptSiteName-Contributors
GLS-CHILD-$DeptSiteName-Approvers

ROOT Domain Groups
DLS-ROOT-$DeptSiteName-Owners
DLS-ROOT-$DeptSiteName-Contributors
DLS-ROOT-$DeptSiteName-Approvers
DLS-ROOT-$DeptSiteName-ReadOnly
The follwing powersell command would do the trick.
  • Specify the server to run
New-ADGroup -server “AD02.CHILD.braindumpblog.plc”
  • Specify the name of the group using our variable
-Name GLS-CHILD-$DeptSiteName-Owners
  • Specify the SAM Account name as i would need this later…..
-SamAccountName GLS-CHILD-$DeptSiteName-Owners
  • Specify the Group Type (Global Security in this Case)
-GroupCategory Security -GroupScope Global
  • Specify the display name
-DisplayName GLS-CHILD-$DeptSiteName-Owners
  • Specify the description
-Description “This provides full access control to the SharePoint Site $DeptSiteName”
  • Specify where in AD i wanted to store it
-Path “OU=Sharepoint,OU=Application Access Control,OU=Global,OU=Access Control,OU=braindumpblog,DC=CHILD,DC=braindumpblog,dc=plc”
I then needed to declare the variables at the top of the script, so thought this is where i will prompt the admin to enter it.
$DeptSiteName = Read-Host “Enter The SharePoint Site Name Here”
…….
So for a new TESTING Department Publishing Site, I would need the follwing groups greated
CHILD Domain Global Security Groups
GLS-CHILD-TESTING-Owners
GLS-CHILD-TESTING-Contributors
GLS-CHILD-TESTING-Approvers

ROOT Domain Groups
DLS-ROOT-TESTING-Owners
DLS-ROOT-TESTING-Contributors
DLS-ROOT-TESTING-Approvers
DLS-ROOT-TESTING-ReadOnly
And here is the script that i can use over and over again to do it….. and all i will be asked for is the Dept Site Name

START OF SCRIPT

Import-Module ActiveDirectory

$DeptSiteName = Read-Host “Enter The SharePoint Site Name Here”

Echo $DeptSiteName

Echo “Creating CHILD Domain Groups”

New-ADGroup -server “AD02.CHILD.braindumpblog.plc” -Name GLS-CHILD-$DeptSiteName-Owners -SamAccountName GLS-CHILD-$DeptSiteName-Owners -GroupCategory Security -GroupScope Global -DisplayName GLS-CHILD-$DeptSiteName-Owners -Description “This provides full access control to the SharePoint Site $DeptSiteName” -Path “OU=Sharepoint,OU=Application Access Control,OU=Global,OU=Access Control,OU=braindumpblog,DC=CHILD,DC=braindumpblog,dc=plc”

New-ADGroup -server “AD02.CHILD.braindumpblog.plc” -Name GLS-CHILD-$DeptSiteName-Contributors -SamAccountName GLS-CHILD-$DeptSiteName-Contributors -GroupCategory Security -GroupScope Global -DisplayName GLS-CHILD-$DeptSiteName-Contributors -Description “This provides read/write access control to the SharePoint Site $DeptSiteName” -Path “OU=Sharepoint,OU=Application Access Control,OU=Global,OU=Access Control,OU=braindumpblog,DC=CHILD,DC=braindumpblog,dc=plc”

New-ADGroup -server “AD02.CHILD.braindumpblog.plc” -Name GLS-CHILD-$DeptSiteName-Approvers -SamAccountName GLS-CHILD-$DeptSiteName-Approvers -GroupCategory Security -GroupScope Global -DisplayName GLS-CHILD-$DeptSiteName-Approvers -Description “This provides Approve access control to the SharePoint Site $DeptSiteName” -Path “OU=Sharepoint,OU=Application Access Control,OU=Global,OU=Access Control,OU=braindumpblog,DC=CHILD,DC=braindumpblog,dc=plc”

Echo “Creating ROOT Domain Groups”

New-ADGroup -server “AD02.braindumpblog.plc” -Name DLS-ROOT-$DeptSiteName-Owners -SamAccountName DLS-ROOT-$DeptSiteName-Owners -GroupCategory Security -GroupScope DomainLocal -DisplayName DLS-ROOT-$DeptSiteName-Owners -Description “This provides full access control to the SharePoint Site $DeptSiteName, No Users should be added to this group they should be added to the CHILD Domain Groups” -Path “OU=Sharepoint,OU=Application Access Control,OU=Domain Local,OU=Access Control,OU=braindumpblog,DC=braindumpblog,DC=plc”

New-ADGroup -server “AD02.braindumpblog.plc” -Name DLS-ROOT-$DeptSiteName-Contributors -SamAccountName DLS-ROOT-$DeptSiteName-Contributors -GroupCategory Security -GroupScope DomainLocal -DisplayName DLS-ROOT-$DeptSiteName-Contributors -Description “This provides read/write access control to the SharePoint Site $DeptSiteName, No Users should be added to this group they should be added to the CHILD Domain Groups” -Path “OU=Sharepoint,OU=Application Access Control,OU=Domain Local,OU=Access Control,OU=braindumpblog,DC=braindumpblog,DC=plc”

New-ADGroup -server “AD02.braindumpblog.plc” -Name DLS-ROOT-$DeptSiteName-ReadOnly -SamAccountName DLS-ROOT-$DeptSiteName-ReadOnly -GroupCategory Security -GroupScope DomainLocal -DisplayName DLS-ROOT-$DeptSiteName-ReadOnly -Description “This provides read only access control to the SharePoint Site $DeptSiteName, No Users should be added to this group they should be added to the CHILD Domain Groups” -Path “OU=Sharepoint,OU=Application Access Control,OU=Domain Local,OU=Access Control,OU=braindumpblog,DC=braindumpblog,DC=plc”

New-ADGroup -server “AD02.braindumpblog.plc” -Name DLS-ROOT-$DeptSiteName-Approvers -SamAccountName DLS-ROOT-$DeptSiteName-Approvers -GroupCategory Security -GroupScope DomainLocal -DisplayName DLS-ROOT-$DeptSiteName-Approvers -Description “This provides Approve access control to the SharePoint Site $DeptSiteName, No Users should be added to this group they should be added to the CHILD Domain Groups” -Path “OU=Sharepoint,OU=Application Access Control,OU=Domain Local,OU=Access Control,OU=braindumpblog,DC=braindumpblog,DC=plc”

END OF SCRIPT

Open Up Powershell and run the script, it will ask you to enter the SharePoint Site Name Here, I entered TESTING and it created the following groups in the correct OUs in my child and root domains.

GLS-CHILD-TESTING-Owners
GLS-CHILD-TESTING-Contributors
GLS-CHILD-TESTING-Approvers

DLS-ROOT-TESTING-Owners
DLS-ROOT-TESTING-Contributors
DLS-ROOT-TESTING-Approvers
DLS-ROOT-TESTING-ReadOnly

So we now have our AD groups created and the next time i want to create the next site, i would just run the script and then enter the new site name…..so now thats the AD Groups created its on to part two. :-)

Site Setup Auditing Powershell Script

Posted: 12th January 2012 by JR52MAR in Microsoft, SharePoint
Tags: ,
Comments Off
Number of View: 83

I wanted to audit the setup of my sharepoint team sites, so first of all i ran the following powershell script

get-SPSite -identity https://intranet.braindumpblog.com/teams/sites | Get-SPWeb -limit all | export-csv c:\scripts\sharepoint\statistics\Team_site_Setup-Audit.csv

This was great but it gave me too many fields i was not bothered about so i altered the script and only chose the parameters i wanted, here was the final script.

get-SPSite -identity https://intranet.braindumpblog.com/teams/sites | Get-SPWeb -limit all | Select-Object -Property Title, Description, ParentWeb, IsMultilingual, RequestAccessEnabled, RequestAccessEmail, RecycleBinEnabled, ServerRelativeURL | export-csv c:\scripts\sharepoint\statistics\Team_site_Setup-Audit.csv

Comments Off
Number of View: 31

$SiteName = Read-Host “Enter the URL for the site whose Request Access Email you wish to set”

$EmailAddress = Read-Host “Enter the email address you wish to send access requests to for $SiteName”

 

$web = Get-SPWeb $SiteName

$web.RequestAccessEmail = $EmailAddress

 

$web.Dispose()

Delete SharePoint Site with Powershell

Posted: 12th January 2012 by JR52MAR in Microsoft, SharePoint
Tags: , ,
Comments Off
Number of View: 36

$TeamSiteName = Read-Host “Enter the Name of the team Site you wish to delete eg TEST”

 

Remove-SPWeb – identity “https://intranet.braindumpblog.co.uk/teams/sites/$TeamSiteName -Confirm:$True

Template Name used to create site

Posted: 9th January 2012 by JR52MAR in Microsoft, SharePoint
Tags: ,
Comments Off
Number of View: 51

If you looking to find details of the site template used to create an existing site in a site collection, this can be done by attaching to the site through the SPWeb object and getting the WebTemplate and WebTemplateId property values, as follows:

$web = Get-SPWeb http://portal
write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId
$web.Dispose()

This will produce an output similar to the text below:

Web Template: BLANKINTERNET  | Web Template ID: 53


Comments Off
Number of View: 54

If you need to enable alternate languages for a web in SharePoint (assuming you are using a multilingual supported template and you have some language packs installed), you can achieve this by navigating to the MUI settings page in SharePoint and selecting the options.

So,

1) Site Actions
2) Site settings
3) Site Administration – Language Settings
4) Select the ‘Alternate Languages’ you would like to support
5) Click OK

This will notice that this needs to be done on each web individually, you can’t specify it at the top level and have it filter down. PowerShell to the rescue!

Use the following script: (the URL parameter prompted for needs to be the site collection URL)

————————————————————————————————

param($url = $(Read-Host -Prompt “Enter Site Url”))

Add-PSSnapin Microsoft.SharePoint.Powershell -errorAction SilentlyContinue

Try
{
$site = Get-SPSite -Identity $url

$site | Get-SPWeb -limit all | ForEach-Object {

$templates = $site.GetWebTemplates($_.Language)
$template = $templates[$_.WebTemplate]

if($template.SupportsMultiLingualUI)
{
$_.IsMultiLingual = $true

$installedLanguages = [Microsoft.SharePoint.SPRegionalSettings]::GlobalInstalledLanguages ;
$supportedUICultures = $_.SupportedUICultures ;

ForEach($language in $installedLanguages)
{
$culture = New-Object System.Globalization.CultureInfo($language.LCID)
$selected = $supportedUICultures | Where-Object{$_.LCID -eq $language.LCID}�
if($selected -eq $null)
{
Write-Host “Adding ” $culture.Name ” to web ” $_.Url
$_.AddSupportedUICulture($culture)
}
}

$_.OverwriteTranslationsOnChange = $true;
$_.Update()
}

}
}
Catch
{
Write-Warning “An Error Occurred…”
Write-Error $_
}

Comments Off
Number of View: 61

With the aid of our SharePoint Consultants who designed and implemented the solution, we have only rolled out the “MyContent” functionality of SharePoint 2010 MySite to a select few users, and only then when they are a member of a AD security group. A Number of the key users have already requested that we increase their site limits.

First of all I could not find what the actual limit was set to, so to find this I had to go to Central Administration ~ Applications Management ~ Manage Web Applications ~ Select Mysites Web Application ~ General Settings ~ Click Default Quota Template. Ours was set at 100 Mb with a warning at 80 Mb.

I did not want to increase the limit of all users mysite quotas so instead need to find a solution to only increase certain users. Even if i did want to change the limit for all, by changing the default quote template value this will only take effect for newly created My Sites. My Sites that are already created DO NOT inherit this new setting. They must be changed individually or by using a application (see CodePlex)

To increase storage quota for My Sites already created:

Central Administration ~ Application Management ~ click on Site Collection ~ Configure Quotas and Locks ~ Click Change Site Collection and Find the user’s personal site, click on it ~ In the Site Quota Information section, click the Current Quota Template drop-down box and select Individual Quota, then enter the new desired amounts ~ Click OK

Comments Off
Number of View: 62

Quick and simple, send an email to AD accounts expiring before a specified date.  The $body is specific to my org needs, but simply customize this to suit.  Give values to $smtp,$from,$subject etc and away you go.

 

Function GetMsgBody {
Write-Output @”
<p>Dear $name,</p>
Your ABC network account is about to expire.<br/>
Please email helpdesk@abc.com or simply hit ‘reply’, and include the following details to have your account extended.<br/>
<br/>
Your name:<br/>
The department you currently volunteer in:<br/>
The staff supervisor’s name you currently report to:<br/>
The current status of your involvement with ABC (Staff/Student/Volunteer):<br/>
<br/>
Kind Regards,<br/>
ABC IT Services
“@
}

Get-QADUser -AccountExpiresBefore “31/01/2012″ -Enabled -SizeLimit 0 | ForEach-Object {
#Setup email variables
$smtpserver= “” # Enter your smtp server
$from= “” # Enter your from address
$subject= “” # Enter your email subject
$email= $_.mail
$name= $_.givenName
[string]$body= GetMsgBody

#Execute PowerShell’s Send-MailMessage Function
Send-MailMessage -BodyAsHtml:$true -Body $body -To $email -From $from -SmtpServer $smtp -Subject $subject
}

 

Ref http://poshcode.org/3153