Sitecore PowerShell Extensions
Slack
YouTube
Stack Exchange
Donate
Search…
Introduction
Disclaimer
Installation
Training
Community
Interfaces
Working with Items
Modules
Remoting
Security
Releases
Troubleshooting
Code Snippets
Appendix
Common
Add-BaseTemplate
Add-ItemVersion
Close-Window
ConvertFrom-CliXml
ConvertFrom-ItemClone
ConvertTo-CliXml
Expand-Token
Get-Archive
Get-ArchiveItem
Get-Cache
Get-Database
Get-ItemClone
Get-ItemCloneNotification
Get-ItemField
Get-ItemReference
Get-ItemReferrer
Get-ItemTemplate
Get-ItemWorkflowEvent
Get-SitecoreJob
Get-SpeModule
Get-SpeModuleFeatureRoot
Get-TaskSchedule
Get-UserAgent
Import-Function
Invoke-JavaScript
Invoke-Script
Invoke-ShellCommand
Invoke-Workflow
New-ItemClone
New-ItemWorkflowEvent
New-UsingBlock
Out-Download
Publish-Item
Read-Variable
Receive-File
Receive-ItemCloneNotification
Remove-BaseTemplate
Remove-ArchiveItem
Remove-ItemVersion
Reset-ItemField
Restart-Application
Restore-ArchiveItem
Send-File
Send-SheerMessage
Set-HostProperty
Set-ItemTemplate
Show-Alert
Show-Application
Show-Confirm
Show-FieldEditor
Show-Input
Show-ListView
Show-ModalDialog
Show-Result
Show-YesNoCancel
Start-TaskSchedule
Test-BaseTemplate
Test-Rule
Update-ItemReferrer
Update-ListView
Write-Log
Indexing
Packaging
Presentation
Provider
Security
Session
Powered By
GitBook
Invoke-Script
Executes a script from Sitecore PowerShell Extensions Script Library. This command used to be named Execute-Script - a matching alias added for compatibility with older scripts.
Syntax
Invoke-Script [-Item] <Item> [-ArgumentList <Object[]>]
Invoke-Script [-Path] <String> [-ArgumentList <Object[]>]
Detailed Description
Executes a script from Sitecore PowerShell Extensions Script Library.
© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions
Aliases
The following abbreviations are aliases for this cmdlet:
Execute-Script
Parameters
-Item <Item>
The script item to be executed.
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
true (ByValue, ByPropertyName)
Accept Wildcard Characters?
false
-Path <String>
Path to the script item to be executed. Path can be absolute or Relavie to Script library root. e.g. the following two commands are equivalent:
PS master:> Invoke-Script 'master:\system\Modules\PowerShell\Script Library\Examples\Script Testing\Long Running Script with Progress Demo' PS master:> Invoke-Script 'Examples\Script Testing\Long Running Script with Progress Demo'
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
-ArgumentList <Object[]>
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Sitecore.Data.Items.Item
Outputs
The output type is the type of the objects that the cmdlet emits.
System.Object
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
1
Invoke-Script
'Examples\Script Testing\Long Running Script with Progress Demo'
Copied!
EXAMPLE 2
Run a script with arguments passed in.
1
$scriptItem
=
Get-Item
-
Path
"master:"
-
ID
"{35311878-54EF-4E7A-9B95-3B63F5DEE97D}"
2
​
3
$arguments
= @
{
4
TemplateId =
"{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"
5
}
6
$scriptItem
|
Invoke-Script
-
ArgumentList
$arguments
Copied!
The arguments are passed and used in the called script like below:
1
param
(
$params
)
2
$templateId
=
$params
.
templateId
3
​
4
Get-ItemReferrer
-
ID
$templateId
Copied!
Related Topics
​
https://github.com/SitecorePowerShell/Console/
​
​
Import-Function
​
Previous
Invoke-JavaScript
Next
Invoke-ShellCommand
Last modified
10d ago
Export as PDF
Copy link
Contents
Syntax
Detailed Description
Aliases
Parameters
-Item <Item>
-Path <String>
-ArgumentList <Object[]>
Inputs
Outputs
Notes
Examples
EXAMPLE 1
EXAMPLE 2
Related Topics