-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathUSN.ps1
More file actions
15 lines (12 loc) · 774 Bytes
/
USN.ps1
File metadata and controls
15 lines (12 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#Requires -RunAsAdministrator
# Prompt user to select one of the available drive letters
$drives = gwmi Win32_LogicalDisk|select-object -property DeviceID
$drive = $drives|Out-GridView -OutputMode Single -Title 'Please select a drive letter'
$drive=$drive.deviceID
Write-Host "(USN.ps1):" -f Yellow -nonewline; write-host " Selected drive: $($drive)" -f White
#Format of the csv filename and path:
$filenameFormat = $env:userprofile + "\desktop\usn_" + (Get-Date -Format "dd-MM-yyyy hh-mm") + ".csv"
Write-host "Selected rows will be saved as: "-f Yellow -nonewline; Write-Host $filenameFormat -f White
#Create output:
$fs = @("usn", "readjournal" ,"$($drive)", "csv")
&fsutil $fs |Out-File -FilePath $filenameFormat -Encoding Unicode -Append