-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The variable '$allPartition' cannot be retrieved because it has not been set. #27
Comments
Still looking for an answer here. |
So you are trying to run the script against a folder without the recurse flag, either pick a single disk, or use -Recurse. |
sorry, but it is not related to -Recurse, i am experiencing same issue with script. Just as example PS C:\Scripts> .\invoke-fslshrinkdisk.ps1 -Path D:\Profiles\nq_S-1-5-21-101500254-2653624075-3746861667-9024 -PassThru -Recurse Name : ODFC_nq.VHDX Name : Profile_nq.vhdx |
I'm also getting this issue on occasion. |
I was getting this issue, and managed to track down the cause, at least in my environment. TLDR: ensure Microsoft Storage Spaces SMP service(smphost) is not disabled. When stepping through the script, I found that "Get-Partition -DiskNumber $mountedDisk.Number" was returning an error:
Drilling down a bit further, a straight get-partition returned no results. This lead me to a helpful reddit thread, which pointed out that smphost is required for the get-partition script to work. If smphost is simply stopped, it will be started by the get-partition script, but in our case, it was disabled, preventing it from starting. Microsoft has guidance on whether or not to disable the service located here, which recommends not to disable the service. As far as the script goes, could we get a simple bit of error handling that checks if smphost is disabled, and throws a warning that it is required for the script to function if it is detected as disabled? |
Hey there,
When running the code on a 'test' directory (robo-copied 2 files 1 VHD & 1 VHDX from our FSLogix storage directories) using the following command: .\Invoke-FslShrinkDisk.ps1 -Path C:\Temp\Test -ThrottleLimit 1 -LogFilePath C:\Temp\VHDShrinkLogFile.csv
It runs but then spits this into the log file for every file: "The variable '$allPartition' cannot be retrieved because it has not been set."
I have read the other issues where the script is run on low compute machines, I'm running on a VM with 12 CPU but have added the ThrottleLimit 1 parameter in there as well.
Thoughts?
Thanks
The text was updated successfully, but these errors were encountered: