Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Anyone ever deal with setting Terminal Service profile info via powershell?
New Posts  All Forums:Forum Nav:

Anyone ever deal with setting Terminal Service profile info via powershell?

post #1 of 3
Thread Starter 
Hey all,

Creating a program at work to automate our new hire process (using VB for the UI and powershell for the execution).

It's nothing fancy but it is coming along well so far except for one item in particular I am stuck on, setting the terminal service profile in. (Profile path, home drive, home drive path).

I have found the code to change it for someone who already has a path and I need to change it to something else but the issue I am finding is that for a brand new user I am unable to set the info.

I was reading this site

https://alwinperotti.wordpress.com/2013/08/05/get-the-remote-desktop-services-profile-path-terminal-services-profile-path-with-powershell/

and instead of the invokeget to get the info I did an invokeset and it worked for changing someone elses path to something else but failed stating It couldn't find the info when trying to set it on a new user.


any thoughts?
Server/Gaming Rig
(22 items)
 
  
CPUCPUMotherboardGraphics
Intel E5-2670 intel E5-2670 Asus Z9PE-D8 WS Visiontek R9 390 
RAMHard DriveHard DriveHard Drive
8x4GB DDR3 1333 ECC Registered Toshiba 5TB X300 Seagate 4TB HGST 4TB 
Hard DriveHard DriveHard DriveHard Drive
Sandisk 240GB Sandisk 480GB Samsung 830 128GB Toshiba 6TB X300 
Hard DriveHard DriveOptical DriveOS
Toshiba 5TB X300 Toshiba 5TB X300 WH16NS40 Windows 10 Pro 
MonitorMonitorKeyboardPower
Dell S1715H Dell u2311h blackwidow ultimate Kingwin Lazer platinum 1000w 
CaseMouse
Corsair 800D Deathadder Chroma 
  hide details  
Reply
Server/Gaming Rig
(22 items)
 
  
CPUCPUMotherboardGraphics
Intel E5-2670 intel E5-2670 Asus Z9PE-D8 WS Visiontek R9 390 
RAMHard DriveHard DriveHard Drive
8x4GB DDR3 1333 ECC Registered Toshiba 5TB X300 Seagate 4TB HGST 4TB 
Hard DriveHard DriveHard DriveHard Drive
Sandisk 240GB Sandisk 480GB Samsung 830 128GB Toshiba 6TB X300 
Hard DriveHard DriveOptical DriveOS
Toshiba 5TB X300 Toshiba 5TB X300 WH16NS40 Windows 10 Pro 
MonitorMonitorKeyboardPower
Dell S1715H Dell u2311h blackwidow ultimate Kingwin Lazer platinum 1000w 
CaseMouse
Corsair 800D Deathadder Chroma 
  hide details  
Reply
post #2 of 3
ooo I have no experience in VB or powershell, but do have experience of user profiles in my capacity as a network admin a good few years back (it was an NT 4.0 environment).

From what I can gather, you're creating a new user, then trying to set new paths on the profile. Where I think you may be getting stuck, is trying to change info which isn't created yet. The new user profile won't be created till you try and log that user on, it is at that point the new user profile is created. It will only be after that, that you could use the invokeset to change the info. I think what you may have to do, is find some way to automatically log the new user in, then back out, once the new user profile is created, and then try to set the data.

also, If i remember right, I didn't need to do any of that, I'm sure we just set the stuff up in the default profile (where windows gets it's new user info from), so maybe you need to be looking at altering the default profile, which should then automatically pull in the info you want at first logon of the new user. I wish I could remember more, but maybe it'll give you a couple of ideas of where to look.

Good luck!
post #3 of 3
Thread Starter 
Quote:
Originally Posted by latelesley View Post

ooo I have no experience in VB or powershell, but do have experience of user profiles in my capacity as a network admin a good few years back (it was an NT 4.0 environment).

From what I can gather, you're creating a new user, then trying to set new paths on the profile. Where I think you may be getting stuck, is trying to change info which isn't created yet. The new user profile won't be created till you try and log that user on, it is at that point the new user profile is created. It will only be after that, that you could use the invokeset to change the info. I think what you may have to do, is find some way to automatically log the new user in, then back out, once the new user profile is created, and then try to set the data.

also, If i remember right, I didn't need to do any of that, I'm sure we just set the stuff up in the default profile (where windows gets it's new user info from), so maybe you need to be looking at altering the default profile, which should then automatically pull in the info you want at first logon of the new user. I wish I could remember more, but maybe it'll give you a couple of ideas of where to look.

Good luck!

Thanks for the reply,

Yeah every single other attribute of the users profile I had no issues setting but for whatever reason Microsoft made this one section different.

Probably not the most ideal way but I was able to create a "template" user of the sorts with no info set except for the Terminal service profile info so when I create the new user it copies that data and then I am able to change the data to what I want on the new user.
Server/Gaming Rig
(22 items)
 
  
CPUCPUMotherboardGraphics
Intel E5-2670 intel E5-2670 Asus Z9PE-D8 WS Visiontek R9 390 
RAMHard DriveHard DriveHard Drive
8x4GB DDR3 1333 ECC Registered Toshiba 5TB X300 Seagate 4TB HGST 4TB 
Hard DriveHard DriveHard DriveHard Drive
Sandisk 240GB Sandisk 480GB Samsung 830 128GB Toshiba 6TB X300 
Hard DriveHard DriveOptical DriveOS
Toshiba 5TB X300 Toshiba 5TB X300 WH16NS40 Windows 10 Pro 
MonitorMonitorKeyboardPower
Dell S1715H Dell u2311h blackwidow ultimate Kingwin Lazer platinum 1000w 
CaseMouse
Corsair 800D Deathadder Chroma 
  hide details  
Reply
Server/Gaming Rig
(22 items)
 
  
CPUCPUMotherboardGraphics
Intel E5-2670 intel E5-2670 Asus Z9PE-D8 WS Visiontek R9 390 
RAMHard DriveHard DriveHard Drive
8x4GB DDR3 1333 ECC Registered Toshiba 5TB X300 Seagate 4TB HGST 4TB 
Hard DriveHard DriveHard DriveHard Drive
Sandisk 240GB Sandisk 480GB Samsung 830 128GB Toshiba 6TB X300 
Hard DriveHard DriveOptical DriveOS
Toshiba 5TB X300 Toshiba 5TB X300 WH16NS40 Windows 10 Pro 
MonitorMonitorKeyboardPower
Dell S1715H Dell u2311h blackwidow ultimate Kingwin Lazer platinum 1000w 
CaseMouse
Corsair 800D Deathadder Chroma 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Anyone ever deal with setting Terminal Service profile info via powershell?