Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powershell script

Status
Not open for further replies.

bobsa32

Technical User
Jan 19, 2006
168
Hi,

I am struggling with what should be an easy script, I need to map a user on a TS 2008 box to the connecting computers CD. The CD is shared and I can connect to it by running:

$net = $(New-Object -ComObject WScript.Network);
$net.MapNetworkDrive("e:", "\\PC\cd");

However, I want to do this automatically by using something like:

$net = $(New-Object -ComObject WScript.Network);
$net.MapNetworkDrive("e:", "\\%clientname%\cd");

Is there a %clientname% alternative in powershell that will work, or a better script?

Thanks in advance
 
I may have misread.

So the user is coming into a TS2008 server. Then you want that user to map back to its local CD drive?

You can configure the redirection on the TS 2008 for clients, no script needed.

Or, I would utilize the clients RDP session to utilize local devices and resources. I believe you can set this allowance on the TS side as well for all clients. It may even let you specify the exact letter for the drive in question.



_______________________________________
Great knowledge can be obtained by mastering the Google algorithm.
 
By default, Terminal Services maps client drives automatically upon connection, including the CD-Rom

_______________________________________
Great knowledge can be obtained by mastering the Google algorithm.
 
%computername% will give you the name of the computer you are on with.

To make this a bit more difficult. We only want to give access to CD's for some users, so the RDP client brings nothing across with it.

hence the reason for doing this with a script/GPO
 
Thanks for all the input guys, to be honest I had never thought of using the "runthese programs after logon", but it worked a treat.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top