-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The script runs in its native form at first but then fails and kicks out when it encounters a VHD that is mounted.
To Reproduce
Have a user logged into a VDI desktop and run the script on their volume. When it comes to their vhd the script will fail and say that it can't identify a drive letter.
Expected behavior
I expect it to log that the disk is mounted and continue on.
Desktop (please complete the following information):
- OS: Windows Server 2016 Standard
Additional context
Here's how I got it to keep going past the failure.
I inserted a function that I retrieved from another script that may be one of yours. I modified it some to make it work though.
function checkFileStatus($FileInfo)
{
try
{
$fileStream = $FileInfo.Open( [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
$filestream.Close()
return $false
}
catch
{
return $true
}
}
Then I inserted the bold text below to screen for mounted containers
# Step through each Container
ForEach ($container in $Containers) {
****$locked = checkFileStatus($container)
If ($locked -eq $true) {continue}****
skest3qc
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working