Creating a PS script to restart the webclient service

Associate
Joined
20 Aug 2007
Posts
1,333
Location
Solihull
Hi guys, I'm trying to create a script to restart with Webclient service, after 8 hours of inactivity my users' connection sharepoint online folders stop, and a dead easy fix is to restart webclient and it fixes it immediately, I need a certified script that a user can just double click on desktop to restart the webclient, the script itself is easy, it's getting it to run is the hardest bit.

I could also use a script for ipconfig /release and ipconfig /renew as we have a dodgy router that has a tendency to time out connections too, so a quick fix script for this would be great too!

as I said, the actually commands im fine with, and creating the scripts, it's just getting it signed to a point where it will run happily on all my users machines :)
 
Just realised I can have this running as a .bat file

@Echo off
ipconfig /release
echo
echo The IP address has been released. Waiting to renew…
echo
ipconfig /renew
echo The IP address has been renewed

this works in the "C:\Users\UserName" directory

Does anyone know how I could create a batch file to run this

net stop webclient
net start webclient

WITHOUT the user running command in elevated mode, because most users are blocked from running admin command prompt obviously, is there a work around to run that without elevation? :)
 
If you have it running in powershell, you can call the .ps1 file from the batch file if you prefer to keep it separate from users. You could also schedule the batch file in task scheduler or something like that.

Place this code in your batch file and edit it to point to the .ps1 file:

Code:
powershell.exe -noexit -ExecutionPolicy RemoteSigned -File C:\myFolder\myAwesomeScript.ps1

This elevates the execution policy of the powershell script to allow it to run as well. Worth a try maybe.
 
Just realised I can have this running as a .bat file

@echo off
ipconfig /release
echo
echo The IP address has been released. Waiting to renew…
echo
ipconfig /renew
echo The IP address has been renewed

this works in the "C:\Users\UserName" directory

Does anyone know how I could create a batch file to run this

net stop webclient
net start webclient

WITHOUT the user running command in elevated mode, because most users are blocked from running admin command prompt obviously, is there a work around to run that without elevation? :)

If the user doesn't have rights to run the actual commands then a script won't get by this, unless the script is executing on a scheduled task running as another user for example. Being able to execute a script does not give the user running the script any more permissions than they would have had normally.
 
Progress on this - I have this script running as admin users, regardless of who is logged on, it's running from every log in, indefinitely every 15 minutes to keep the connection refreshed, there's bound to be a problem with it at some point though :P
 
Back
Top Bottom