Guest User

Untitled

a guest
Mar 13th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function Invoke-SPERemoteScriptForPropertyTableValue {
  2. Param([string]$propertyTableKey)
  3.  
  4. $hashValue = -1
  5. $script = {
  6. $db = Get-Database "core"
  7. $previousValue = $db.Properties.GetLongValue($using:propertyTableKey, -1000)
  8.  
  9. $previousValue
  10. }
  11.  
  12. $session = New-ScriptSession -Username $User -Password $Pass -ConnectionUri $Url
  13. $myValue = Invoke-RemoteScript -Session $session -ScriptBlock $script -ErrorAction Stop -Verbose
  14. Stop-ScriptSession -Session $session
  15. $session = $null
  16.  
  17. return $myValue
  18. }
  19.  
  20. function Invoke-Script($propertyKeys)
  21. {
  22. foreach ($propertyKey in $propertyKeys)
  23. {
  24. $propertyValue = Invoke-SPERemoteScriptForPropertyTableValue $propertyKey
  25. Write-Host "Property Value for Key $propertyKey is $propertyValue"
  26. }
  27. }
  28.  
  29. $User = $OctopusParameters['SitecoreUserName']
  30. $Pass = $OctopusParameters['SitecoreUserPassword']
  31. $Url = $OctopusParameters['Url']
  32. $myArray = "Prop1", "Prop2","Prop3"
  33.  
  34. Invoke-Script $myArray
Add Comment
Please, Sign In to add comment