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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network Printer and Folder/Drive Sharing how?

Status
Not open for further replies.

miq

Programmer
Apr 24, 2002
315
PK
2 Question plz.

should the printer be connetected to windows 2003 server in order to enable it for Network sharing? -- Its not a Network printer but a laserjet HP printer that i want to share.

What steps one need to take in order to configure Folder/Drive and printer sharing without explicitly configuring xp clients?

meaning, i want workstations (xp based) to automatically detect network printer and shared resources at logon.


 
In that case you could connect the printer to the server and share it, that way you can use a logon script to add it to your clients without having to visit them.
 
Something along these lines in a VB user logon script should work.

Code:
On error resume next

Dim WSHNetwork, Path


Set WSHNetwork = CreateObject("Wscript.Network") 


'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"


set WSHNetwork = Nothing


wscript.quit

Or for a more detailed FAQ on logon scripts take a look here.

faq329-5798


 
Yes, the printer should be connected to the server (since it doesn't have it's own printer sharing funcitonality).

Install the printer on the server. Then go to the Configure Your Server wizard and enable file and printer sharing on the server, then set up the correct drives and printers (it will walk you through this). Then you'll probably need to restrict access to the printer/drives to the specific groups (are you running a domain?).

Then write the logon script to go out to all of the client machines.
 
thanx jshurst and PCE.

what about shared folders? can we assign drive letter to shared folder and use logon script to configure clients in a single go?
 
Yes, you can do it all in one shot. PorkChopExpress already provided you with the answer. Please refer to my FAQ as was posted above. There you will find all the code you need to accomplish your goal.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Mark I have successfully implemented my desired code snippets from your faq but i was forced to change not only shared resource name but also "\server" with "& strComputer &" string.

one more question plz. After applying logon script thing one of the workstation (xp machine - the only i have tested so far) is not allowing me to choose any option when i try to log off or shutdown my computer instead it restarts it all the time. Any idea why i am experiencing this behaviour?
 
^^ sorry it was the virus causing restart.

Problem is that only server machine on which i edited domain group policy to incorporate logon script is displaying things properly i.e. shared folder on destkop and windows versioning too but non of the clients are responding to it. The group policy is at top domain level and its the only policy present at the moment. Non of the workstations --xp and windows 2003 machines-- is responding to logon script.


Here is the code i am using :


=========================================


ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")

'Automatically find the domain name
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")

'Grab the user name
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

'Grab the computer name for use in add-on code later
strComputer = WSHNetwork.ComputerName


'----------------------------------------------------------------------


'Configure the PC to show the Windows Version and Service Pack
'as an overlay to the desktop above the System Tray
'=====================================
HKEY_CURRENT_USER = &H80000001
strComputer = WSHNetwork.Computername
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Control Panel\Desktop"
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
ValueName = "PaintDesktopVersion"
dwValue = 1
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, dwValue


'----------------------------------------------------------------------

'create desktop shortcut
SET oFSO = Wscript.CreateObject("Scripting.FileSystemObject")
strDsk = WshShell.SpecialFolders("Desktop")
' What is the label for the shortcut?
strshortcut = strDsk & "\shared.lnk"
If Not oFSO.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
' What is the path to the shared folder?
oUrlLink.TargetPath = "\\pdcvds\shared_resources\"
oUrlLink.Save
End If



'-------------------------------------------------

'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
 
i edited domain group policy to incorporate logon script

For starters you should NEVER put anything in the Default Domain Policy except password policies.

Create your own policy and put the script there. Remove it from the default policy.

Second verify that you have done this in AD Users & Computers or in GPMC so we know what you are looking at.

Third, what security did you set on the policy?

Forth, what OU are your users in and what OU are your computers in. Do you have policy inherritance turned off on either?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
1)

2) I did it in AD User and Computers

3) I din't alter default security settings.

4) Hmmm... all my users are in an OU other then default OU. I created an OU for the organization and thee child OUs for admins, developers and mangers. Users are in these three OUs. Each of thees OU (sub OUs) contins a group and respective users are added to the group.

here is the heirarchey

compnay name
--> admins --> Admin group --> all admins users here
--> developers --> dev group --> all dev users here
--> Managers --> mangager group --> all managers here


5) computers are not in custom created OUs but default computers OU.

6) Policy inheretnce is turned on. I even tried "no override" setting for testing.
 
OK everything was fine expect clients were unable to find path to vbs file. I put it in a shared folder with adequate rights and everything is smooth.

:D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top