2
1
I'm using a script to keep a mapped networkconnection alive, but ofcourse the mapped connection is gone when I logout. The point is now, that I'm running this on Windows Server 2008 R2, where I use remote desktop to login on the administrator account. However, it should remain logged in and not remove the mapped connection as this script takes care of not logging out on MS office 365 sharepoint.
Is there a way to keep the mapped networklocation (L:) available after logout? So the script can run to remain the connection?
# Create an IE Object and navigate to my SharePoint Site
$ie = New-Object -ComObject InternetExplorer.Application
$ie.navigate('https://xxx.sharepoint.com/')
# Don't need the object anymore, so let's close it to free up some memory
$ie.Quit()
# Just in case there was a problem with the web client service
# I am going to stop and start it, you could potentially remove this
# part if you want. I like it just because it takes out a step of
# troubleshooting if I'm having problems.
Stop-Service WebClient
Start-Service WebClient
# We are going to set the $Drive variable here, this is just
# going to tell the command what drive letter to map you can
# change this to whatever you want (if you change it to a
# drive that is already mapped it will overwrite it, so be careful.
$Drive = "L:"
# You can change the drive destiniation to whatever you want,
# it has to be a document library or folder of course.
$DrvDest = "https://xxx.sharepoint.com/files/"
# Here is where we create the object to map the network drive and
# then map the network drive
$net = New-Object -ComObject WScript.Network;
$net.mapnetworkdrive($Drive,$DrvDest)
# That is the end of the script, now schedule this with task
# scheduler and every so often and you should be set.
If I understand you correctly, your actual problem is getting logged out of MS Office 365 when you log out of your remote desktop session and this is how you want to avoid that? – Der Hochstapler – 2012-10-16T10:17:42.557
I would like to keep the L: drive available on logout, or some other way around so I can run any .NET application that can use the L: to upload files to with that location. – Rob – 2012-10-16T12:25:40.633
Why? What applications? NT Services? Mapped drives are session specific. – snowdude – 2012-10-20T09:35:44.360