-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathInvokeWebService.ps1
More file actions
41 lines (26 loc) · 921 Bytes
/
InvokeWebService.ps1
File metadata and controls
41 lines (26 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#$VerbosePreference = "Continue"
Import-Module -Name SPE -Force
if(!$credential) {
$credential = Get-Credential
}
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://console/" -Credential $credential
$script1 = {
[Sitecore.Security.Accounts.User]$user = Get-User -Identity admin
$user
}
Invoke-RemoteScript -ScriptBlock $script1 -Session $session
$script2 = {
$params.date.ToString()
}
$args = @{
"date" = [datetime]::Now
}
#Invoke-RemoteScript -ScriptBlock $script2 -Session $session -ArgumentList $args
$script3 = {
Import-Function -Name Invoke-ApiScript
Invoke-ApiScript -ScriptBlock {
Get-Item -Path master:\content\home | Select-Object -Property Name, ItemPath
Get-ChildItem -Path master:\content\home -Recurse | Select-Object -Property Name, ItemPath
}
}
#Invoke-RemoteScript -ScriptBlock $script3 -Session $session