Solved

Add network place through Logon script

Posted on 2007-11-17
16
1,963 Views
Last Modified: 2012-08-14
I have added manually a network place using the wizard and entered this address.
http://sharepointserver:16701/sites/Netadmins/default.aspx

Now I have  many users that I need to be mapped to the same address. I would like to do that for them througha logon script.

thanks
0
Comment
Question by:jskfan
  • 9
  • 7
16 Comments
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20306272
Hi jskfan,

This should work for you..........


regards
Chandru
Const NETHOOD = &H13&
 
Set objWSHShell = CreateObject("Wscript.Shell")
Set objShell = CreateObject("Shell.Application")
 
Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self
strNetHood = objFolderItem.Path
 
strShortcutName = "Sharepoint Server"
strShortcutPath = "http://sharepointserver:16701/sites/Netadmins/default.aspx"
 
Set objShortcut = objWSHShell.CreateShortcut _
    (strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save

Open in new window

0
 

Author Comment

by:jskfan
ID: 20307381
the script creates a shortcut to the website, it's not exactely what I need.
when I add network place manually it creates sort of a folder where users can drop files and they will automatically show up in the sharepoint document library. that's what I need.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20307388
How does the folder look like?

The nethood folder is where all the my network places are stored

regards
Chandru
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 12

Expert Comment

by:chandru_sol
ID: 20307391
Can you also let me know when you add through mynetwork places wizard what is the URL you use to see that folder?

0
 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20307398

Just change this two location to folder

strShortcutName = "Sharepoint Server"
strShortcutPath = "http://sharepointserver:16701/sites/Netadmins/default.aspx"

since the path is URL you are seeing that as the URL shortcut.
Change to something like this

strShortcutName = "Sharepoint Server"
strShortcutPath = "\\sharepointserver\share"

Hope this helps....

regards
Chandru
0
 

Author Comment

by:jskfan
ID: 20308907
here is exactely what I did when added network place:
http://sharepointserver:16701/sites/Netadmins/Network Administrators Library/Network Administrator files

now in my network places it ceated a folder named "Network administrator files on sharepointserver"
now if I double click on it, it opens the folder with the same files that exist in sharepoint document library.
now if a user edits a file or add /delete a file inside the folder the document library also gets updated, it's jjust like one place but accessed in 2 different ways. It's also vice versa if a file gets modified/added/deleted in sharepoint document library, it will be modifed/added/deleted in Network administrator files on sharepointserver folder.
0
 

Author Comment

by:jskfan
ID: 20308914
your script creates a shortcut to the website instead of to the Network place folder.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20309953
Can you navigate to the user location to find a folder nethood?

c:\documents and settings\username\nethood you will find all the folders in the mynetwork places and these are shortcuts pointing to the folders and they are not the actual folders.

When you copy something or you udpate something it automatically gets updtaed

regards
Chandru
0
 

Author Comment

by:jskfan
ID: 20311878
when you get to Nethood, there are many folders there and one of the folder that I need the script to map to is Network Administrator files


 
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20311988
Yes so if we add a shortcut referring to the folder that will showup in the mynetwork places.

Did you try this script adding a unc share?

regards
Chandru
0
 

Author Comment

by:jskfan
ID: 20312048
Const NETHOOD = &H13&
 
Set objWSHShell = CreateObject("Wscript.Shell")
Set objShell = CreateObject("Shell.Application")
 
Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self
strNetHood = objFolderItem.Path
 
strShortcutName = "Sharepoint Server"
strShortcutPath ="C:\Documents and Settings\%username%\NetHood\Network Administrator files on sharepoint server"
 
Set objShortcut = objWSHShell.CreateShortcut _
    (strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save
wscript.echo "done"






when I create a shortcut manually and put this path in the target "C:\Documents and Settings\%username%\NetHood\Network Administrator files on sharepoint server"
it works just fine but it doesn't create the shortcut when I put the same path in the script.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20312076
Just put the share of the server not the local system path

something like \\server\share

Hope this helps..........
0
 

Author Comment

by:jskfan
ID: 20312154
This script fixed it.


Set oWS = WScript.CreateObject("WScript.Shell")
   
   sLinkFile = "ADminFiles.LNK"
   
   Set oLink = oWS.CreateShortcut(sLinkFile)
   
   oLink.TargetPath = "C:\Documents and Settings\%username%\NetHood\Network Administrator Files on sharepointserver"
   '      oLink.Arguments = ""
   '      oLink.Description = "MyProgram"
   '      oLink.HotKey = "ALT+CTRL+F"
   '      oLink.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2"
   '      oLink.WindowStyle = "1"
   '      oLink.WorkingDirectory = "C:\Program Files\MyApp"
   oLink.Save
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20312191
Oh! great!

If that sovled your purpose you can post to refund your points

regards
Chandru
0
 

Author Comment

by:jskfan
ID: 20313401
But When I put it in GPO/log script, it will create the shortcut in the same folder where the script is :
\\dCname\SYSVOL\domainname.com\Policies\{95DEF793-8EBF-4151-929D-13058E0FE581}\User\Scripts\Logon

I need the shortcut to show on user desktop
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20313502
The above script also creates a shortcut link... Adminfile.lnk

so other script also should work.

Try this script for shortcut and hope this helps....
'##############################################################
'# CREATESHORTCUT_WSH.VBS
'# CREATES A SHORTCUT ON THE USERS DESKTOP TO A SPECIFIED FILE
'# 
'# USES: WINDOWS SCRIPT HOST
'# LANGUAGE: VISUAL BASIC SCRIPTING EDITION
'##############################################################
 
'FORCE EXPLICIT VARIABLE DECLARATION
option explicit
 
'STEP OVER ERRORS FOR CUSTOM ERROR REPORTING
on error resume next
 
'DECLARE VARIABLES
dim shell, desktopPath, link, sys32Path
 
'INSTANTIATE THE WINDOWS SCRIPT HOST SHELL OBJECT
Set shell = WScript.CreateObject("WScript.shell")
 
'SET THE PATH TO THE WINDOWS DESKTOP FOLDER & MY DOCUMENTS FOLDER
desktopPath = shell.SpecialFolders("Desktop")
sys32Path = "%SystemRoot%\system32"
 
'CREATE A SHORTCUT ON THE USER'S DESKTOP
Set link = shell.CreateShortcut(desktopPath & "\shortcut to Calculator.lnk")
 
'SET THE PROPERTIES FOR THE SHORTCUT
link.Description = "My Shortcut"
link.TargetPath = sys32Path & "\calc.exe"
link.WindowStyle = 3
link.WorkingDirectory = desktopPath
link.Save
 
'CLEANUP OBJECTS
set shell = nothing
 
'LET THE USER KNOW IF THERE WAS AN ERROR AND WHAT IT WAS
'OTHERWISE CONFIRM SHORCUT CREATION
if err.number <> 0 then
	msgbox "There was an error creating your shortcut." & vbCrLf & err.description & vbCrLf & err.source, vbOKOnly-vbExclamation, "Shortcut Builder"
else
	msgBox "Your new shortcut has been created!" & vbCrLf & "Please check your Windows Desktop.", vbOKOnly-vbInformation, "Shortcut Builder"
end if

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

756 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