Impossibile to store DiskNumber knowing the disk label

%3CLINGO-SUB%20id%3D%22lingo-sub-2791327%22%20slang%3D%22en-US%22%3EImpossibile%20to%20store%20DiskNumber%20knowing%20the%20disk%20label%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2791327%22%20slang%3D%22en-US%22%3E%3CPRE%3E%3CSPAN%3EHi%20all!%20I%20need%20help%20you%20if%20possibile.%3CBR%20%2F%3EI%20Need%20to%20storage%20in%20the%20variable%20(example%20%24NumberDisk)%20the%20disk%20number%20where%20the%20label%20of%20Disk%20is%20(for%20example)%20'XXXXX'.%3CBR%20%2F%3EIf%20I%20use%20this%20command%20the%20variable%20reply%20is%20null%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPS%20C%3A%5CUsers%5Cutente%26gt%3B%20Get-Disk%20%7C%20Where-Object%20%7B%20%24_.FriendlyName%20-eq%20'XXXXX'%20%7D%0APS%20C%3A%5CUsers%5Cutente%26gt%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3EMy%20mission%20is%20assign%20letter%20(Example%20b)%20a%20disk%20with%20label%20%22XXXXX'%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24DiskNumber%20%3D%20Get-Disk%20%7C%20Where-Object%20%7B%20%24_.FriendlyName%20-eq%20'XXXXX'%20%7D%0AGet-Partition%20-DiskNumber%20%24(%24DiskNumber.Number)%20%7C%20Set-Partition%20-%20newDriveLetter%20b%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3EWhy%20is%20not%20possibile%3F%20Is%20There%20another%20way%3F%3C%2FSPAN%3E%3C%2FPRE%3E%3CPRE%3E%3CSPAN%20class%3D%22%22%3EThank%20you!%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2791327%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2794886%22%20slang%3D%22en-US%22%3ERe%3A%20Impossibile%20to%20store%20DiskNumber%20knowing%20the%20disk%20label%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2794886%22%20slang%3D%22en-US%22%3EI%20follow%20the%20same%20cmdlets%20you%20used%20and%20was%20able%20to%20set%20a%20drive%20letter%3CBR%20%2F%3Ewhat%20is%20the%20error%20you%20are%20getting..%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
New Contributor
 

 

 

 

 

PS C:\Users\utente> Get-Disk | Where-Object { $_.FriendlyName -eq 'XXXXX' }
PS C:\Users\utente>

 

 

 

 

Impossible is assign letter (Example b) a disk with label "XXXXX'

 

 

 

 

$DiskNumber = Get-Disk | Where-Object { $_.FriendlyName -eq 'XXXXX' }
Get-Partition -DiskNumber $($DiskNumber.Number) | Set-Partition - newDriveLetter b

 

 

 

 

 
 

 

1 Reply
I follow the same cmdlets you used and was able to set a drive letter
what is the error you are getting..