I have several mapped network drives that I can only access when on my company's LAN or when connected to the VPN using OpenVPN.
When I connect to the network in our office, the drives automatically connect. However, when I connect via the VPN, only two of the drives automatically connect (I tried net use /persistent:yes but that didn't seem to make a difference, so maybe I'm not understanding that command).
What's odd to me is that the rest of my drives say "unavailable" as the status when I type net use. If I click on the drive in Windows Explorer, the drive status is then blank. Those drives do not display when I use get-PSDrive. Not sure if that's related to the autoconnect or not.
Any ideas for what I can do to automatically connect to my other drives?

This the solution that ended up working for me:
I used Task Scheduler to create a task that automatically runs when I access OpenVPN. The tasks launches a .cmd file with the following code:
This calls the following PowerShell script.