Skip to content

Instantly share code, notes, and snippets.

View IAMPetro's full-sized avatar

IAMPetro IAMPetro

View GitHub Profile
@IAMPetro
IAMPetro / meteor-nginx
Created August 23, 2016 10:10 — forked from dweldon/meteor-nginx
This is an example of how to configure nginx to serve a meteor app.
server {
listen 80;
server_name app.example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
server_name app.example.com;
@IAMPetro
IAMPetro / Add-BulkEmailAlias.ps1
Last active December 11, 2016 09:29
Exchange: Add Email Aliases
function Add-BulkEmailAlias
{
<#
.Synopsis
This function will create the desired email aliases for the specified mailbox
.Example
C:\PS>Add-BulkEmailAlias -PrimaryEmailAddress your.mailbox@mydomain.com -AliasPrefix testAlias –Domain @mydomain.com -NumberOfAlias 1000
This example will create 1000 emails addressess called testAlias1@mydomain.com > testAlias1000@mydomain.com
@IAMPetro
IAMPetro / Remove-BulkEmailAlias.ps1
Last active December 11, 2016 09:31
Exchange: Remove Email Aliases
function Remove-BulkEmailAlias
{
<#
.Synopsis
This function will create the desired email aliases for the specified mailbox
.Example
C:\PS>Remove-BulkEmailAlias -PrimaryEmailAddress your.mailbox@mydomain.com -AliasPrefix testAlias –Domain @mydomain.com -NumberOfAlias 1000
This example will remove 1000 emails aliases called testAlias1@mydomain.com > testAlias1000@mydomain.com
@IAMPetro
IAMPetro / SharePoint.ItemCheckedInEventReceiver.cs
Created December 11, 2016 09:39
SharePoint: Elevated Perms Event Receiver
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;
namespace SharePoint.Development.EventReceivers
@IAMPetro
IAMPetro / Add-SPContentTypeField.ps1
Created December 11, 2016 09:52
SharePoint: Add Content Type Fields
function Add-SPContentTypeField
{
<#
.Synopsis
This function will allow you to add a library field to a Content Type
.Description
This function will add the nominated site column/ library column to a nominated Content Type
within all of the 'Document Libraries' in the given Site Collection
.Example
C:\> Add-SPContentTypeField –SiteUrl “http://yourdomain.com/sites/Finance –FieldName "myField" -CTypeAddedTo "myContentType"
@IAMPetro
IAMPetro / Add-SPSiteContentType.ps1
Last active December 11, 2016 10:00
SharePoint: Add Site Content Type
function Add-SPSiteContentType
{
<#
.Synopsis
This advanced function adds a Content Type to a Document Library based on search criteria.
.Description
This function will add a new Content Type into all libraries that contain the -lookForCT specified in the function.
This function also produces a series of reports capturing the work carried out in the function, and any errors experienced.
.Example
@IAMPetro
IAMPetro / Remove-SPSiteContentType.ps1
Last active December 11, 2016 10:06
SharePoint: Remove Site Content Types
function Remove-SPSiteContentType
{
<#
.Synopsis
This advanced function iterates through all documents within a document library and changes the
identified Content Type to a new Content Type.
.Description
This function will change document Content Types for all items within a document library whose Content Type
is specified as -CTypeToRemove, and changes it to the new Content Type -lookForCT.
@IAMPetro
IAMPetro / Change-SPMultiFileContentType.ps1
Last active December 11, 2016 10:13
SharePoint: Change Multiple File Content Types
function Change-SPMultiFileContentType
{
<#
.Synopsis
This advanced function iterates through all documents within a document library and changes the
identified Content Type to a new Content Type.
.Description
This function will change document Content Types for all items within a document library
whose Content Type is specified as -oldCT and changes it to the new Content Type -newCType .
@IAMPetro
IAMPetro / Import-RecipientDataProperty.ps1
Created December 11, 2016 21:56
Exchange: Example use of Import-RecipientDataProperty command
# This command will import a single image into the thumbnailPhoto attribute in an Active Directory account
Import-RecipientDataProperty -Identity "" -Picture -FileData ([Byte[]]$(Get-Content -Path "C:\User_Images\" -Encoding Byte -ReadCount 0))
# If you want to remove either the current picture, you can do so by using
Set-Mailbox "" -RemovePicture
@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