Question

Refining Worklet for Mapping Network Drives

  • 10 July 2023
  • 6 replies
  • 147 views

Badge

Hello, I am trying to make a worklet to map certain network drives to users PCs. I tried the script that was posted about 3 years ago in “Worklet: Network Drive Mount Windows” and it runs but in File Explorer gives the error “Disconnected Network Drive”. Does anyone have an updated script or know how to tweak the previous script to fix this issue? 

Thanks! 


6 replies

Userlevel 2
Badge

Hey @kaitlin.houser! Thanks for raising this. I made sure to add this as a request to include in the Automox Worklet Catalog, so we will make sure we get an updated version published. There may be a number of scenarios causing that error when you visit File Explorer.

If you were to map a network drive manually does it work as expected for you? Does the network drive require credentials in order to connect? Do we see a disconnect after logout/reboot or immediately after creation?

 

Userlevel 1
Badge

I run into the same issue. Manually mapping the drive does not give any issues, only through automox it says disconnected

 

 

Badge

Hey @kaitlin.houser! Thanks for raising this. I made sure to add this as a request to include in the Automox Worklet Catalog, so we will make sure we get an updated version published. There may be a number of scenarios causing that error when you visit File Explorer.

If you were to map a network drive manually does it work as expected for you? Does the network drive require credentials in order to connect? Do we see a disconnect after logout/reboot or immediately after creation?

 

Hi Ben,

 

Yes, manually mapping through file explorer works as expected. The drives do not require credentials but they are apart of our network, so maybe it is not talking to our network correctly (sorry, I am not quite as knowledgeable with the behind the scenes of my companies file shares) And it is disconnected as soon as I check it in file explorer after I run the script. Thanks! 

Userlevel 3

Hi @kaitlin.houser and @saman.keyhan,

We’ve just published a new Worklet to our Catalog that will generate a scheduled task to map a network drive during your user’s next log on action. You can check it out here: 

Windows - Configuration - Map Network Drive via Scheduled Task

 

 

To use this Worklet, you’ll want to make sure that you complete these two variables in both the evaluation and remediation code blocks:

$driveLetter = ""
$uncPath = ""

 

When the evaluation code runs during a scan, it will check to see if the defined network drive and drive letter already exist. If found, the device is compliant and the worklet run will end.  If not found, the device will be flagged for remediation.

 

The remediation code will then create a scheduled task named "Map Network Drive" that runs as the current user with the trigger being their log on action. 

 

Let me know if you have any questions about implementing the worklet in your environment.

 

Have a great weekend!

Badge

Hi @kaitlin.houser and @saman.keyhan,

We’ve just published a new Worklet to our Catalog that will generate a scheduled task to map a network drive during your user’s next log on action. You can check it out here: 

Windows - Configuration - Map Network Drive via Scheduled Task

 

 

To use this Worklet, you’ll want to make sure that you complete these two variables in both the evaluation and remediation code blocks:

$driveLetter = ""
$uncPath = ""

 

When the evaluation code runs during a scan, it will check to see if the defined network drive and drive letter already exist. If found, the device is compliant and the worklet run will end.  If not found, the device will be flagged for remediation.

 

The remediation code will then create a scheduled task named "Map Network Drive" that runs as the current user with the trigger being their log on action. 

 

Let me know if you have any questions about implementing the worklet in your environment.

 

Have a great weekend!

Hi John, I appreciate the new worklet. I just tried to make a policy with it, but unfortunately it seems like I am still getting the “disconnected network drive” where the name of the drive should be. It does let me enter the folder, but I’m just confused on why the name doesn’t seem to be transferring over correctly. 

 

Thanks! 

Userlevel 3

Good morning @kaitlin.houser !

I’ll reach out to you directly via a private message to investigate this further.

 

Have a great day!

 

John

Reply