Solved

Terminal Services profile path script annoyance

Posted on 2006-07-23
2
517 Views
Last Modified: 2011-09-20
Hi experts,

Trying to get a script to work, want to populate the Terminal Services profile path when users log into the network by calling a script from AD. It all seems to work on the server, but when I run it from the client machines I get an "object not supported" error when it tries to set the TS profile path. I suspect this is because the PCs, being XP, aren't TS aware, and don't know of the existence of this property of the user object? But that's just my guess.  The script is shown below:

(thanks very much for any help!)

'
' VBScript login script
' v1.1    12/07/06
' -----------------------------------------------------------------

Option Explicit
Dim objNetwork, objUser, objSysInfo
Dim strSharedDriveLetter, strSharedDrivePath, strUsername, strProfilePath
Dim strTermSvrProfilePath, strHomeDriveLetter, strHomeDrivePath, strUserPath, strUserCn

strSharedDriveLetter = "S:"
strSharedDrivePath = "\\iaserveresp\shared"
strHomeDriveLetter = "H:"
strHomeDrivePath = "\\iaserveresp\user\"
strProfilePath = "\\iaserveresp\profile\"
strTermSvrProfilePath = "\\iaserveresp\profile\termsvc\"

Set objNetwork = CreateObject("WScript.Network")
Set objSysInfo = CreateObject("ADSystemInfo")

strUserCn = objSysInfo.UserName
strUsername = objNetwork.Username
strUserPath = "LDAP://" & strUserCn
set objUser = GetObject(strUserPath)

' Now create user object to set TS & normal profile paths if theyre blank

if objUser.ProfilePath = "" Then ' if the user's profile path is blank
  objUser.ProfilePath = strProfilePath & strUserName ' set it to what it should be
  objUser.SetInfo
end if

if objUser.TerminalServicesProfilePath = "" Then ' if the user's TS profile path is blank
  objUser.TerminalServicesProfilePath = strTermSvrProfilePath & strUserName
  objUser.SetInfo
end if

' Time to map the various drives
On Error Resume Next ' If there's already an S: drive it'll throw an error
objNetwork.MapNetworkDrive strSharedDriveLetter, strSharedDrivePath ' heres where it maps the drive
If Err.Number <> 0 Then ' if there is an error mapping the drive
  On Error Resume Next
  objNetwork.RemoveNetworkDrive "S:", True, True  ' delete the existing mapping
  objNetwork.MapNetworkDrive "S:", strSharedDrivePath  ' and create a new one
End If

WScript.Quit

0
Comment
Question by:georgemason
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
oBdA earned 125 total points
ID: 17164401
That doesn't work because you're running it as a logon script. The users (and the logon script is running in the user's context) don't have permissions to change their properties in AD.
You need to change the script so that it iterates through your AD, checks for users with empty roaming profile paths, and changes it to the appropriate location.
0
 
LVL 1

Author Comment

by:georgemason
ID: 17164529
Right. That's that idea then.

I'll schedule the script to run once a week and correct any empty profile paths. Thanks for posting.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
We have put together a white paper that aims to explain how MSPs can both improve their offering and ease the pain of after-hours service by: -Suggesting changes to workflow -Indicating how to rework policy to suit your team -Providing ConnectW…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question