Add Log on Script mapping fileshare to Azure Virtual Desktop environment


To set up a logon script for an Azure virtual desktop that maps a file share, you will need to follow these steps:

  1. Create a new file share in Azure Files or in a storage account.
  2. Create a logon script using the net use command to map the file share to a drive letter on the virtual desktop.
  3. Upload the logon script to a location that is accessible to the virtual desktop.
  4. Assign the logon script to the virtual desktop.

Here is an example logon script that maps the file share \\\myshare to the drive letter Z::

net use Z: \\\myshare /persistent:yes

To assign the logon script to the virtual desktop, you can use the Azure portal or the Azure PowerShell module. Here is an example of how to do it using the Azure PowerShell module:

  1. Install the Azure PowerShell module on your local machine.
  2. Connect to your Azure subscription using the Connect-AzAccount cmdlet.
  3. Run the following command to set the logon script for the virtual desktop:
Set-AzWvdDesktop -ResourceGroupName 'myResourceGroup' -WorkspaceName 'myWorkspace' -HostPoolName 'myHostPool' -DesktopName 'myDesktop' -LogonScript '\\path\to\logon\script.cmd'

Replace myResourceGroup, myWorkspace, myHostPool, and myDesktop with the actual names of your resource group, workspace, host pool, and virtual desktop. Replace \\path\to\logon\script.cmd with the actual path to the logon script that you uploaded.

When the virtual desktop is restarted, the logon script will be run and the file share will be mapped to the specified drive letter.

Leave a Reply

Your email address will not be published. Required fields are marked *