Script by PowerShell for copy and format flash drive.
- Skript triggered by inserting USB flash in to PC.
- Automaticly copy files in flash to path directory. Default user Desktop in folder CopiedFiles.
- After copy, format USB flash drive and eject it.
- For Windows systems
To deploy this project run
start.bat Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "PATH TO <start.bat>" & Chr(34), 0
Set WinScriptHost = Nothing- Replace PATH TO with path to file start.bat.
Powershell -executionpolicy remotesigned -File PATH TO <usb.ps1> > PATH TO <log.log>- Replace PATH TO with path to file usb.ps1 and to log.log.
For some error of Authorization run two lines below in PowerShell as administrator:
Get-ExecutionPolicySet-ExecutionPolicy RemoteSigned