Using accounts to access remote services

Hey,

So before PU was around, I turned PUD into services. That service would run as the account that had privaliges to access whatever application or device it was trying to hit for information.

Now that the PU does this is there a way to handle this rather than having to load credentials into scripts?

I did try and change the account the main PU runs as to the user account but that has not worked.

Thanks

Also if you need to load powershell modules into the code whats the best location to do this from, as I know each dashboard is span out to its own powershell running instance.

When you say it doesn’t work, what do you mean? It should work if you change the credentials of the service. The one thing you might need to look out for is that since the service was run as system first, the files in %ProgramData%\PowerShellUniversal and %ProgramData%\UniversalAutomation may have system level permissions set on them and you might need to adjust them manually.

I am loading a powershell module for citrix to run commands on a remote server. This works on the old PUD running as a service under the same account that I changed PU too. But on the PU server its not performing as expected. Its very hard to trouble shoot this issue as I dont know where the problem is, unless its something to do with a component I was using in PUD that has moved in PU.

Let me look at that too but if you have any other ideas please let me know.

Thanks

$GridSplat = @{
Headers = @(’ ‘,“Select”, “UserName”, “SessionState”,“App”,“SessionKey”)
Properties = @(’ ',“Select”, “UserName”, “SessionState”,“App”,“SessionKey”)
Endpoint = {
Get-BrokerSession -AdminAddress AdminAddress | select UserFullName,SessionState,LaunchedViaPublishedName,SessionKey | ForEach-Object { [PSCustomObject]@{ Select = New-UDCheckbox -Id .sessionkey -OnChange (
New-UDEndpoint -Endpoint {
CheckBoxElement = Get-UDElement -Id
.SessionKey
Cache:CheckBoxElementArray[.SessionKey] = @{
Checked = CheckBoxElement.Attributes["checked"] UserName =
.UserFullName
SessionState = _.SessionState App = .LaunchedViaPublishedName
SessionKey = _.SessionKey } } ) UserName =
.UserFullName
SessionState = _.SessionState App = .LaunchedViaPublishedName
SessionKey = $
.SessionKey
}
}| Out-UDGridData
}
}
New-UDGrid -ID SESSION @GridSplat -PageSize 10

This is what I used to use. looking at the new UD grid I wonder if this just does not work anymore.

New-UDDashboard -Title “XXXXX” -Content {
Add-PSSnapin citrix*
$AdminAddress = “XXXXX”
New-UDHeading -Text “Sessions” -Size 1
$Cache:CheckBoxElementArray = @{ }
$GridSplat = @{
Headers = @(’ ‘,“Select”, “UserName”, “SessionState”,“App”,“SessionKey”)
Properties = @(’ ',“Select”, “UserName”, “SessionState”,“App”,“SessionKey”)
Endpoint = {
Get-BrokerSession -AdminAddress AdminAddress | select UserFullName,SessionState,LaunchedViaPublishedName,SessionKey | ForEach-Object { [PSCustomObject]@{ Select = New-UDCheckbox -Id .sessionkey -OnChange (
New-UDEndpoint -Endpoint {
CheckBoxElement = Get-UDElement -Id
.SessionKey
Cache:CheckBoxElementArray[.SessionKey] = @{
Checked = CheckBoxElement.Attributes["checked"] UserName =
.UserFullName
SessionState = _.SessionState App = .LaunchedViaPublishedName
SessionKey = _.SessionKey } } ) UserName =
.UserFullName
SessionState = _.SessionState App = .LaunchedViaPublishedName
SessionKey = $
.SessionKey
}
}| Out-UDGridData
}
}
New-UDGrid -ID SESSION @GridSplat -PageSize 10
New-UDButton -Text “End Session(s)” -OnClick {
Show-UDModal -Header {
New-UDHeading -Size 4 -Text “Are you sure you want to end the following sessions?” -Color “red”
} -Content {
New-UDTable -Title ‘Selected’ -Headers @(“UserName”, “SessionState”,“App”,“SessionKey”) -Content {
foreach ($Key in $Cache:CheckBoxElementArray.Keys) {
[PSCustomObject]@{
UserName = $Cache:CheckBoxElementArray[$key][‘UserName’]
SessionState = $Cache:CheckBoxElementArray[$key][‘SessionState’]
App = $Cache:CheckBoxElementArray[$key][‘App’]
SessionKey = $Cache:CheckBoxElementArray[$key][‘SessionKey’]
} | Out-UDTableData -Property @(“UserName”, “SessionState”,“App”,“SessionKey”)
}
}
New-UDMuButton -Text “Confirm” -Variant contained -Style @{ backgroundColor = “green”; color = “white” }-OnClick {
foreach ($Key in $Cache:CheckBoxElementArray.Keys) {
Get-BrokerSession -AdminAddress $AdminAddress -SessionKey $Cache:CheckBoxElementArray[$key][‘SessionKey’] | stop-BrokerSession
}
Hide-UDModal
$Cache:CheckBoxElementArray = @{ }
Sync-udelement -ID SESSION
}
New-UDMuButton -Text “Cancel” -Variant contained -Style @{ backgroundColor = “red”; color = “white” } -OnClick {
Hide-UDModal
$Cache:CheckBoxElementArray = @{ }
Sync-udelement -ID SESSION
}
}
}
}

That is the full code, So I wonder if its due to changes in either the grid or the table.

I’m still unclear what you mean when it says it doesn’t work as expected. Are you seeing an error or is the grid just not loading data?

Are you using the v2 framework for this dashboard?

You know I set it to V3, the Grid/table does not display on the webpage at all. But I could try setting it back to version 2 and see if that works?

The v3 framework is very different and you won’t be able to just use your v2 dashboards with that framework. You should try v2 and see how that goes.

Ok ill do that. Ill have to look at converting this to the v3 after.

thanks

Ok so running in V2 now displays the grid but its not connecting to the citrix server to download the information. This means it cant be running as the Service identity.

Again this was me I forgot to remove some edits I made. Sorry.

All is working now :smiley:

1 Like