This software project will connect the network drive using the Drive Name, network path, username and password to connect to a particular drive. If the drive is already connected it will disconnect it.
For disconnecting network drive it uses only drive name and no username and password are required.
The above piece of code will use PowerShell scripts to connect or disconnect the drive.
This project includes two xaml files & powershell scripts as mentioned below:
1) Map_Network_Drive: This xaml file is used to connect the network drive and it takes as input parameter username, password,network path and the name of the drive.
2) Disconnect_Network_Drive: This xaml is used to disconnect the network drive if it is already connected. If no network drive is connected it will display the details in log messages.
3) Map_Network_Drive: This text file contains the PowerShell commands required to connect the network drive. This PowerShell script is used by Map_Network_Drive.xaml to connect to the network drive. It requires username, password, network drive and drive name.
4) Disconnect_Network_Drive: This text file is used to disconnect the network drive if already connected. It will check the details on the basis of the input parameter supplied which is the name of the drive.
All of the above code is designed without hard coding and the code is dynamic, which requires only input parameters so that it can run without any issues.
The above design of xaml code was done to meet the requirements where different processes need to access different paths and files. So by connecting to different network paths, different processes have access to different folders and files. This will achieve the objective of meeting security approvals which may be required in different projects/clients.