Terminal Server profiles script broken in Powershell 5

2

I have been using the following to set and get terminal server profiles through powershell for years:

$user = [ADSI]"LDAP://$dn"
$user.psbase.InvokeGet("terminalservicesprofilepath")
$user.psbase.InvokeSet("terminalservicesprofilepath",'\\server\share\user')

Since upgrading to windows 10 and thus Powershell 5 this no longer works and produces the following error:

 Exception calling "InvokeGet" with "1" argument(s): "Unknown name. (Exception from HRESULT: 0x80020006 
(DISP_E_UNKNOWNNAME))" At line:1 char:1 + ldap.psbase.invokeget("terminalservicesprofilepath")
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
 + FullyQualifiedErrorId : DotNetMethodException

It seems as if MS have removed these properties, anyone found a way around this?

powershell
active-directory
asked on Stack Overflow Feb 19, 2016 by AlexZ • edited Feb 19, 2016 by hjavaher

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0