Powershell and the "WHY NOT"?

avatar

Thanks fro converting the snapip to a module.
Since i have to rewrite my Scripts to accomodate to your changes, i will post my ... findings here.


(Do you support a code tag in forum?)


My current Version: 12.0.7.0
[Executionpolicy]
It should work also with MachinePolicy RemoteSigned

Scope ExecutionPolicy
----- ---------------
MachinePolicy RemoteSigned
UserPolicy RemoteSigned
Process Undefined
CurrentUser Undefined
LocalMachine Bypass

All Comments (13)

avatar

the code tag is

lemme try this to show the actual code ;)

fail: try again
[ code ] [ / code ]

but no spaces inside the brackets ;)

Maurice

avatar

Why don't your cmdlet support objects in the pipeline?
why do i need this:
$objDatasource = (Get-RDMDatasource -Name $DataSourceName).ID | Set-RDMCurrentDataSource

But cannot use this:
$objDatasource = Get-RDMDatasource -Name $DataSourceName | Set-RDMCurrentDataSource



How can i set the Sessions Status (Expired,...)?

avatar

Hi Peter,

Set-RDMCurrentDataSource only supports guid, we will modify it to be able to accept a PSDataSource object or a guid.

To set and get the session status, you need to use the session status property and know these IDs:

Default = {B299F468-BC24-43cb-9417-4FEDFC813E7C}
Disabled = {380B6ED9-94F9-4e1e-B4F6-72714B9D44CD}
Expired = {7B926104-9C7E-4c91-BDAC-DFCCC36B8D70}
Locked = {DE4018E0-38E4-416b-AB4E-DEA6B754C711}
Warning = {123A44CB-7EDC-4ecb-926B-031793668148}


We will create cmdlets to make it easier to manage session status.

Best regards,

Olivier Désalliers

avatar

Remove-RDMSession opens an Error Message (blocking script) on permission issue, see screenshot

Remove-RDMSession -ID $RDMSessionNow.id -Force -ErrorAction SilentlyContinue

RDM24-01-2017 13-28-12_Error.png

avatar

Hello,

What type of data source are you connected to?

Could you please check if you have enough permission on the SQL database to perform a delete on an entry?

Best regards,

Érica Poirier

avatar

I KNOW i don't have the permission (on the SQL Server Always on Datasource)!!
The problem is the reaction of the cmdlet:
Displaying a huge Messagebox is not scriptable!

avatar

How can i set the Department and other fields visible in the GUI with Get-RDMUser + Set-RDMUser ?

PS C:\Users\admcer> $rdmuSERS[16] |fl *


CreateSQLServerLogin : False
IntegratedSecurity : False
Name : MyDomain\User1
Password :
UserInfo : Devolutions.RemoteDesktopManager.Business.Entities.UserEntity
UserType : 3
CanAdd : True
CanDelete : False
CanEdit : True
ConnectionOverrides :
CreationDate : 01.01.0001 00:00:00
CustomSecurity : <?xml version="1.0"?>
<CustomSecurity>
<DenyAdd>
<string>4bb0fe61-7559-4959-866b-236f47e26e2c</string>
<string>60b51bb0-b84d-463a-8cf7-4dc68dec381b</string>
</DenyAdd>
<DenyDelete>
<string>4bb0fe61-7559-4959-866b-236f47e26e2c</string>
<string>4f1f6442-f947-4ce6-ac4a-1dd71b3a3e79</string>
<string>60b51bb0-b84d-463a-8cf7-4dc68dec381b</string>
<string>95acdac9-b646-43b1-9dde-22ce8bc57f0f</string>
<string>f533319a-9346-43d1-b411-f63adc210902</string>
</DenyDelete>
<DenyEdit>
<string>4bb0fe61-7559-4959-866b-236f47e26e2c</string>
</DenyEdit>
<IntegratedSecurity>true</IntegratedSecurity>
</CustomSecurity>
DataSourceID : 00000000-0000-0000-0000-000000000000
Description : ISW
Email : peter.cermak@porscheinformatik.at
LoginEmail :
FirstName : ISW
GroupInfos : {4f1f6442-f947-4ce6-ac4a-1dd71b3a3e79, 4bb0fe61-7559-4959-866b-236f47e26e2c, f533319a-9346-43d1-b411-f63adc210902,
95acdac9-b646-43b1-9dde-22ce8bc57f0f...}
ID : 8570949c-5387-4a25-a284-76e9b1e70360
IsAdministrator : False
IsEnabled : True
IsLockedOut : False
IsNew : False
IsOwner : False
IsTemplate : False
LastLockoutDate :
LastName :

avatar

Hi Peter,

The fields visible in the information tab like the department are in $userObject.UserInfo.UserProfile.

For example:
$rdmuSERS[16].UserInfo.UserProfile.Department = "YourDepartment"
Set-RDMUser $rdmuSERS[16]
Bset regards,

Olivier Désalliers

avatar

My current Version: 12.0.8.0
Win10

[Executionpolicy]
It should work also with MachinePolicy RemoteSigned
Scope ExecutionPolicy
----- ---------------
MachinePolicy RemoteSigned
UserPolicy RemoteSigned
Process Undefined
CurrentUser Undefined
LocalMachine Bypass


Starting Powershell from the UI takes 17 seconds after displaying this message:

......
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
+ FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
P

avatar

Hi,

When you start PowerShell with the UI. RDM sends a script to PowerShell that set the execution policy to avoid errors, imports the module, the current data source and load the connections.

Does it take around 17 seconds on all your data sources?

Also we will add a way to modify the script before the import module. This way you will be able to remove the set execution policy part.

Best regards,

Olivier Désalliers

avatar

It does NOT take 17 seconds if i load the module and datsource in an extra Powershell SessionHi,

avatar

What about:
Remove-RDMSession opens an Error Message (blocking script) on permission issue, see screenshot

Can you somehow manage that PS-commands don't trigger Messageboxes from the Application?

avatar

Hi Peter,

The message box containing only an ok button will not prompt anymore. The content will go in the PowerShell console and won't block the script.

In the cases you have to make a choice, for example a "yes or no question", the question will be in the console like a read-host.

Best regards,

Olivier Désalliers