Archive for February, 2011

Create a new document library.

clip_image002

Create a new content type.

clip_image004

Add your newly created content type to the newly created list.

clip_image006

clip_image008

clip_image010

Create a new document.

clip_image012

Create your footer, or any other document template modifications. Then save document back to the SharePoint document library. Then close MS word.

7

clip_image016

Re-edit the MS word Document.

clip_image018

Add the Document ID Value to the footer. Then save the document as a word document template(.dotx) to the desktop or similar location.

clip_image020

clip_image022

Site Content Types > Content type >Advanced Settings.

clip_image024

Upload the document template just created.

clip_image026

Create new document to confirm your changes have been completed.

clip_image028

Make some changes to the document. Then save this document to SharePoint. Close MS word. Re-open the document, notice the Document ID value is now changed.

P.s. If you would like to use the Document ID as a label. The reference is {Document ID Value}

Run these PowerShell Commands:

 

1
2
$StartUsageHealthDataCollectionProxy  = Get-SPServiceApplicationProxy | ? {$_.TypeName -like "*Usage and Health*"}
$StartUsageHealthDataCollectionProxy.Provision()

Error encountered in background cache check Microsoft.SharePoint.SPEndpointAddressNotFoundException: There are no addresses available for this application.

Make sure you have the corresponding service running for each Service Application that you have created.

ex: Check that you started the “Managed Metadata Web Service”. This can be found here:  Central Admin > System Settings > Manage Services On Server

A client needed a way to remove old domain users from their SharePoint 2010 farm. There was a company merger and they did not want the old domain users showing in the sites.

Enter the root site collection and the search parameter ex: domain and done.

** you might notice a table being created… I left this in here, but its not really used. The client had some additional requirements, that I have not included in this script.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## Reference to SharePoint DLL
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
 
##Ask for WebApp Root url to enumerate or scope scan
Write-Host "Please enter root url of WebApplication, ex: http://contoso"
$siteurl = Read-Host "Value "
Write-Host "Please enter the search parameter, ex: contoso "
$searchP = Read-Host "Value "
 
##Create Table - ScanTable
$ScanTable = New-Object system.Data.DataTable "ScanTable"
$col1 = New-Object system.Data.DataColumn ("LoginName", [string])
$col2 = New-Object system.Data.DataColumn ("URL", [string])
$ScanTable.columns.add($col1)
$ScanTable.columns.add($col2)
 
##Returning info for use in remainder of script
$webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($siteurl)
##Start looping through the sites collections
foreach ($site in $webapp.Sites)
{
    $spSite = new-object Microsoft.SharePoint.SPSite($site.url)
	$spWeb = $spSite.OpenWeb()
 
	##Save file path, guid, and title of each closed webpart
	foreach ($_.LoginName in $spSite.RootWeb.SiteUsers | select LoginName)
	{
	if ($_.LoginName -like "*$searchP*")
	{
	$output = $ScanTable.Rows.Add($_.LoginName, $site.url)
	$spWeb.SiteUsers.Remove($_.LoginName)
	}
	}
 
	##Clean Up
    $spSite.Dispose()
    $spWeb.Dispose()
}
 
##Write txt file
Write-Output $ScanTable | select URL | Sort-Object URL -Unique | Out-File C:users.txt -Append

Posted by IsaacBlum at 23 February 2011

Category: Uncategorized

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

By default the SharePoint Trace service runs as local system.This script will fix that. 

1. Create a SharePoint 2010 Trace Account. Ex: SPTrace

2. Edit lines 2 and 3 of the PowerShell script.

3. Run script on each server in farm. (not FAST or SQL servers) a. PS C:UsersspinstallDesktop> .TraceAccountFix.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Trace Account Details
$TraceAccount = "DomainSPTrace"
$TraceAcctPWD = "Enter The password here"
$SecTraceAcctPWD = (ConvertTo-SecureString $TraceAcctPWD -AsPlainText -force)
 
# Formatting
$TraceAccountDomain,$TraceAccountUser = $TraceAccount -Split "\"
 
# Get the tracing service.
$farm = Get-SPFarm
$tracingService = $farm.Services | where {$_.Name -eq "SPTraceV4"}
 
$Cred_TraceAcct = New-Object System.Management.Automation.PsCredential $TraceAccount,$SecTraceAcctPWD
 
## Add Managed Account for Trace Account
$ManagedAccountTrace = Get-SPManagedAccount | Where-Object {$_.UserName -eq $TraceAccount}
If ($ManagedAccountTrace -eq $NULL) 
{ 
	Write-Host -ForegroundColor White "- Registering managed account" $TraceAccount
	New-SPManagedAccount -Credential $Cred_TraceAcct | Out-Null 
}
Else {Write-Host -ForegroundColor White "- Managed account $TraceAccount already exists, continuing."}
 
 
# Get the managed account.
$managedAccount = Get-SPManagedAccount "$TraceAccount"
If ($tracingService.ProcessIdentity.ManagedAccount -notlike "*$managedAccount*"){
 
# Set the tracing service to run under the managed account.
$tracingService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$tracingService.ProcessIdentity.ManagedAccount = $managedAccount
$tracingService.ProcessIdentity.Update()
 
# This actually changes the "Run As" account of the Windows service.
$tracingService.ProcessIdentity.Deploy()
}
 
Try{
([ADSI]"WinNT://$env:COMPUTERNAME/Performance Log Users,group").Add("WinNT://$TraceAccountDomain/$TraceAccountUser")
}
catch {Write-Host -ForegroundColor White " - $TraceAccount is already an in the Performance Log Users group, continuing."}
 
Write-Host "All Done"
  • Archives

  • Tags

  • Subscribe
  • Pages

  • More

  • Disclaimer…

    This is my personal weblog. The opinions expressed herein are my own and are not representative of any 3rd party influence. The owner of this blog reserves the right to edit or delete any comments submitted to this blog without notice if they are deemed to be spam, offensive or otherwise inappropriate. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.


    Lastly, I do my best to document my sources if the article is not of my own creation. If I have missed or forgotten to source your work. I would love feedback via the comments section. Thank you.

DreamHost promos
SiteLock