• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

Logon Script

Dear Expert,

I'm not sure if this is the right place to ask for this kind of question. I have the following scenario, and I wish it to be done quickly using logon script method.

Scenario:-
Files on server: f:\abc.xls
Logon Domain: ABCDE
Staff Group: STAFF

\\ABCDE\STAFF

I need to drag a file (f:\abc.xls) from my server and copy to all staff PCs's desktop when the users under the group STAFF are logged on to the server. And the file permission is set to FULL.

Anyone know how to compile the logon script for this?

Regards,
Kung Hui
0
kunghui80
Asked:
kunghui80
3 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Download the IFMEMBER command line utility from Microsoft (http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp).  Place it in the logon script folder (\\server\netlogon) and then use the following script:


\\server\netlogon\ifmember "YourDomain\Staff"
If "%errorlevel%" == "1" Copy \\server\staff\abc.xls %userprofile%\desktop
0
 
TheMCSECommented:
The second line in leew's post above should likely read something like:

If "%errorlevel%" == "1" Copy \\server\staff\abc.xls "%userprofile%\desktop"

Since there are spaces in the path, you may receive an error similar to "syntax is incorrect" without the quotes.  Depending upon how distributed your environment may be, you may also want to change the reference to NETLOGON to use the device that authenticated the user.  Something like this:

%logonserver%\netlogon\ifmember "YourDomain\Staff"

If you were opposed to using external utilities, you could likely complete this task using VBScript and ADSI (if your client OS is Windows 2000 or newer or you have the DS client installed on NT4).  Something similar to this saved with a .vbs extension would likely accomplish the task:

Set objWSHNetwork = WScript.CreateObject("WScript.Network")
Set objWSHShell = WScript.CreateObject("WScript.Shell")
Set objGroup = GetObject("WinNT://" & objWSHNetwork.UserDomain & "/Staff")
If objGroup.IsMember("WinNT://" & objWSHNetwork.UserDomain & "/" & objWSHNetwork.UserName) Then
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "\\server\staff\abc.xls", objWSHShell.ExpandEnvironmentStrings("%USERPROFILE%\Desktop")
End If

' The only line that would require modification is the call to the CopyFile method, which would need an accurate source path (and possibly a different destination).  I typed this blind (as I suspect leew did :) , so post back if you encounter any errors.  Good luck!
0
 
Jeffrey Kane - TechSoEasyPrincipal ConsultantCommented:
Mind if I ask why you want to do this?  It seems like a rather complex way to deliver an Excel spreadsheet when Windows Sharepiont Services does exactly that and is a free addition to Server 2003.

If you are unfamiliar with WSS, you may want to take a look because it could solve more than what you are attempting to do:  
http://www.microsoft.com/windowsserver2003/techinfo/sharepoint/overview.mspx

Jeff
TechSoEasy
0
 
kunghui80Author Commented:
Hi,

Just to let you guys know i'm still trying on the solutions, will get back to you soon. Thanks a lot for all the suggestion & idea.

Regards,
Kung Hui
0
 
kunghui80Author Commented:
Thank you guys,

Learnt a lot from your comments.

Regards,
Kung Hui
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now