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
gci master:\ -rec | |
$colors = "Cyan", "Gray","Green","Magenta","Red","White","Yellow" | |
foreach($i in 1..20){ | |
foreach($j in 1..20){ | |
Write-Host ("{0:D3} " -f ($i*20+$j)) -ForegroundColor "$($colors[(Get-Random -Maximum $colors.Length)])" -no | |
Write-Progress -Activity "Line $i, column $j" -PercentComplete (($i*20+$j)/4.2) | |
Start-Sleep -Milliseconds 10 | |
} |
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
# unfortunately does not work, because - #1 - does not really retrieve the file, #2 has problems with logging out | |
Import-Module -Name SPE | |
function Retrieve-SitecorePackage($session, $instance, $PackageName, $Destination){ | |
$loginUri = "$instance/sitecore/login" | |
$login = Invoke-WebRequest -Uri $loginUri -SessionVariable webSession | |
$form = $login.Forms[0] | |
$form.Fields["__EVENTTARGET"] = "" | |
$form.Fields["UserName"] = $session.Username |
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 -Name SPE | |
function Retrieve-SitecorePackage($session, $instance, $PackageName, $Destination){ | |
Invoke-WebRequest "$instance/-/script/file/package/?path=$PackageName&user=$($session.Username)&password=$($session.Password)" -OutFile $Destination -WebSession $webSession | |
} | |
$instance = "http://sitecore8" | |
$session = New-ScriptSession -Username admin -Password b -ConnectionUri $instance | |
$packageName = "package.zip" |
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-ChildItem "$($SitecoreLogFolder)\log*.*" | Sort-Object -Descending LastWriteTime | Select-Object -First 1 | Get-Content -Tail 10 |
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
# replace "target folder" with the path in the media library you want to put your files in. | |
Receive-File -ParentItem (gi "master:\media library\target folder") -AdvancedDialog |
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 New-MediaItem{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$filePath, | |
[Parameter(Position=1, Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$mediaPath) |
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-childitem "master:/media library/Showcase-Group/search/int/images/cars" -rec | | |
? { $_."File Path" -ne $null } | | |
% { $_."File Path" = $_."File Path" -replace "/Replicated", "" } |
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
$days = 7; | |
Get-ChildItem master:\content\home -Recurse | | |
? { $_."__updated" -gt (Get-Date).AddDays(-$days) } | | |
Format-Table -Property ID, Name, "__updated", "__updated by" |
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 Set-ItemFieldToExternalLink{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] | |
[ValidateNotNullOrEmpty()] | |
[Sitecore.Data.Items.Item]$Item, | |
[Parameter(Position=1, Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$FieldName, |