Skip to content

Instantly share code, notes, and snippets.

View IAMPetro's full-sized avatar

IAMPetro IAMPetro

View GitHub Profile
@IAMPetro
IAMPetro / Add-UserProfilePicture.ps1
Last active December 11, 2016 22:22
Exchange: Example in uploading thumbnail into Active Directory
function Add-UserProfilePicture
{
<#
.Synopsis
This is a simple approach to uploading a binary file into an active directory users AD object.
.Example
C:\> Add-UserProfilePicture -user "Joe Bloggs" -picture "C:\images\Joe_Bloggs.jpg"
.Notes
Name: Add-UserProfilePicture
Author: Petro Margaritis
@IAMPetro
IAMPetro / Get-OfflineAddressBook.ps1
Created December 11, 2016 22:24
Exchange: Update Global Address Book
# If you are unsure what the names of your OABs you can run the following command
Get-OfflineAddressBook
# This will list all of the attributes for the OAB
(Get-OfflineAddressBook “Default Offline Address Book”).ConfiguredAttributes | sort-Object name, type
# If you want to change the type assigned to the ThumbnailPhoto, you will first need to remove it
($thumbAtt = (Get-OfflineAddressBook "Default Offline Address Book").ConfiguredAttributes).Remove("thumbnailphoto,Indicator")
# Update the Offline Address Book
Set-OfflineAddressBook "Default Offline Address Book" -ConfiguredAttributes $thumbAtt
# Add the new type for the thumbnailPhoto attribute
$thumbAtt.Add("thumbnailphoto,Value")
@IAMPetro
IAMPetro / Update-SPProfilePhotoStore.ps1
Created December 11, 2016 22:25
SharePoint: Force Creation of Mysite Thumbnails
# This will create thumbnails from the user profile images saved in the My Sites User Profile pictures library
Update-SPProfilePhotoStore –MysiteHostLocation http://mysites -CreateThumbnailsForImportedPhotos 1
@IAMPetro
IAMPetro / Restart-SPTimerService.ps1
Created December 12, 2016 01:49
SharePoint: Restarting the SP Timer Service
function Restart-SPTimerService
{
<#
.Example
C:\>Restart-SPTimerService -serverName "SharePoint1"
This script will restart the Timer Server on the nominated server (-serverName) and will created a log.txt file with the result
.Notes
Name: Restart-SPTimerService
Author: Petro Margaritis
@IAMPetro
IAMPetro / Get-SPServiceApplicationProxy.Example.ps1
Created December 12, 2016 01:51
SharePoint: BCS and External List Item Throttling Snippet 1
$BDCProxy = Get-SPServiceApplicationProxy | where
{
$_.GetType().FullName -eq ('Microsoft.SharePoint.BusinessData.SharedService.' + 'BDCServiceApplicationProxy')
}
@IAMPetro
IAMPetro / Get-SPBusinessDataCatalogThrottleConfig.Example.ps1
Created December 12, 2016 01:52
SharePoint: BCS and External List Item Throttling Snippet 2
Get-SPBusinessDataCatalogThrottleConfig –Scope Database –ThrottleType Items –ServiceApplicationProxy $BDCProxy | Set-SPBusinessDataCatalogThrottleConfig –Maximum 100000 –Default 50000
@IAMPetro
IAMPetro / Get-SPBusinessDataCatalogThrottleConfig.Example.ps1
Created December 12, 2016 01:52
SharePoint: BCS and External List Item Throttling Snippet 3
Get-SPBusinessDataCatalogThrottleConfig –Scope Database –ThrottleType Items –ServiceApplicationProxy $BDCProxy
@IAMPetro
IAMPetro / SharePoint.Kerberos.Example1.ps1
Created December 12, 2016 01:55
SharePoint: Kerberos Authentication Part 1
#Query whether the Web Applications Application Pool account has an SPN
SETSPN -l <DOMAIN>\<ApplicationPoolAccount>
#The Output of the above command will look like this if an SPN has not been registered to the domain account
Registered ServicePrincipalNames for CN=<Domain>,OU=<AD Folder>,DC=<Domain>,DC=<level prefix>:
@IAMPetro
IAMPetro / SharePoint.Kerberos.Example2.ps1
Created December 12, 2016 01:55
SharePoint: Kerberos Authentication Part 1
#Set SPN for the Intranet 'Application Pool Account' on the Contoso Intranet WebApp
SETSPN -A HTTP/intranet.contoso.com contoso\IntranetAppPoolAcc
#Set SPN for the My site 'Application Pool Account' on the Contoso Mysite WebApp
SETSPN -A HTTP/mysite.contoso.com contoso\MySiteAppPoolAcc
@IAMPetro
IAMPetro / SharePoint.Kerberos.Example3.ps1
Created December 12, 2016 01:56
SharePoint: Kerberos Authentication Part 1
#Query the desired Application Pool Account to confirm SPN has been registered correctly
SETSPN -l <DOMAIN>\<ApplicationPoolAccount>