This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-LockedChildItem { | |
<# | |
.SYNOPSIS | |
Gets the locked item at the specified location. | |
.PARAMETER Path | |
Specifies a path to search for locked items. The default location is the current directory (.). | |
.PARAMETER LockedBy | |
Specifies the the owner account locked on the item. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Import Project="$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets" /> | |
<ItemGroup> | |
<AssembliesPath Include="..\SomethingAwesome.Web\bin\SomethingAwesome.Web.dll" /> | |
</ItemGroup> | |
<Target Name="BeforeSitecoreBuild"> | |
<GetAssemblyIdentity AssemblyFiles="@(AssembliesPath)"> | |
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" /> | |
</GetAssemblyIdentity> | |
<CreateProperty Value="%(AssemblyVersion.Version)"> | |
<Output TaskParameter="Value" PropertyName="PackageVersion" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all the enabled users. | |
$users = Get-ADUser -Filter { Enabled -eq $true } -Properties EmployeeId | |
# Collect all the ids and format them to 7 characters. | |
$ids = @{}; $users | ForEach-Object { if($_.EmployeeId) { $ids[("{0:D7}" -f [int]$_.EmployeeId)] += 1 } } | |
$filteredUsers = $users | Where-Object { if($_.EmployeeId) { $ids[("{0:D7}" -f [int]$_.EmployeeId)] -gt 1 } } | |
$filteredUsers | Select-Object -Property SamAccountName, EmployeeId | |
$filteredUsers | Export-Csv -Path "C:\temp\DuplicateEmployeeId-$((Get-Date).ToString('yyyyMMddThhmmss')).csv" -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Down for Maintenance</title> | |
</head> | |
<body> | |
<div> </div> | |
<div id="wrapper"> | |
<div id="page"> | |
<div id="content"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\pngfile\shell\Copy image to clipboard] | |
@="Copy image to clipboard" | |
[HKEY_CLASSES_ROOT\pngfile\shell\Copy image to clipboard\command] | |
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command \"Add-Type -AssemblyName 'PresentationFramework','PresentationCore';[System.Windows.Clipboard]::SetImage((New-Object System.Windows.Media.Imaging.BitmapImage ([System.Uri]'%1')))\"" | |
[HKEY_CLASSES_ROOT\jpegfile\shell\Copy image to clipboard] | |
@="Copy image to clipboard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module ActiveDirectory | |
Set-ADUser -Identity "Michael.West" -Replace @{"thumbnailPhoto" = [byte[]](Get-Content -Path "michael.jpg" -Encoding Byte)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Lists all media items that are not linked to other items. | |
.NOTES | |
Michael West | |
#> | |
# HasReference determines if the specified item is referenced by any other item. | |
function HasReference { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Archives old log files int zip format to a separate archive directory. | |
.NOTES | |
Michael West | |
#> | |
<# | |
Load the function Compress-Archive. The Get-Item command supports a dynamic parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$item = Get-Item -Path "master:\media library\images\koala" | |
$itemNew = Get-Item -Path "master:\media library\images\penguins" | |
$links = Get-ItemReferrer -Item $item -ItemLink | |
foreach($link in $links) { | |
$linkedItem = Get-Item -Path master:\ -ID $link.SourceItemID | |
$itemField = $linkedItem.Fields[$link.SourceFieldID] | |
$field = [Sitecore.Data.Fields.FieldTypeManager]::GetField($itemField) | |
$linkedItem.Editing.BeginEdit() | |
$field.Relink($link, $itemNew) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, | |
// INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | |
using System.Text; | |
using Sitecore.SharedSource.Reflection; | |
using Sitecore.Pipelines.GetAboutInformation; | |
namespace Sitecore.SharedSource.Pipelines | |
{ | |
public class ApplicationDetails |
OlderNewer