Hi,
I've been using the following command line in a macro:
PS C:\directories> Get-Partition -DriveLetter W | Set-Partition -NewDriveLetter G
It worked just fine for a while, then started to give this error message:
Set-Partition : The operation failed with return code 42012
Activity ID: {ad7ee5ca-3f2f-49b8-9abf-2153ce9af4d9}
At line:1 char:32
+ FullyQualifiedErrorId : StorageWMI 42012,Set-Partition
I haven't done anything unusual to the system, which runs on Windows 10.
Previously, though, I had a similar issue, with the powershell giving errors after that same command line, out of the blue. But I solved that problem thanks to some code suggested by an advanced user, which made it work without issues until now.
I'm quoting below the thread with my previous issue and its working solution:
Thanks!
I've been using the following command line in a macro:
PS C:\directories> Get-Partition -DriveLetter W | Set-Partition -NewDriveLetter G
It worked just fine for a while, then started to give this error message:
Set-Partition : The operation failed with return code 42012
Activity ID: {ad7ee5ca-3f2f-49b8-9abf-2153ce9af4d9}
At line:1 char:32
- Get-Partition -DriveLetter W | Set-Partition -NewDriveLetter G
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ FullyQualifiedErrorId : StorageWMI 42012,Set-Partition
I haven't done anything unusual to the system, which runs on Windows 10.
Previously, though, I had a similar issue, with the powershell giving errors after that same command line, out of the blue. But I solved that problem thanks to some code suggested by an advanced user, which made it work without issues until now.
I'm quoting below the thread with my previous issue and its working solution:
Hi,
for years I've been using the PowerShell's commands GET-PARTITION and SET-PARTITION to change drive letters using a macro, without any issue.Recently, PowerShell started giving the "INVALID PROPERTY" error message (see below).
I can't tell when this started to happen, but I recently ran some optimizers, like "Windows repair" by tweaking.com, which my have tampered with the system and the environment variables.
Can someone please hint me on a possible cause or where to start looking for it?
Please, note that I'd prefer to keep using this powershell command, so i.e. diskpart wouldn't be feasible alternative.
I'm using Windows 10 Pro, regularly updated.
Thanks!
PS C:\> Get-Partition
get-partition : Invalid property
At line:1 char:1
- get-partition
- ~~~~~~~~~~~~~
- CategoryInfo : MetadataError: (MSFT_Partition:ROOT/Microsoft/.../MSFT_Partition) [Get-Partition], CimException
- FullyQualifiedErrorId : HRESULT 0x80041031,Get-Partition
try this in cmd:
Code:sc config winmgmt start= disabled net stop winmgmt Winmgmt /salvagerepository %windir%\System32\wbem Winmgmt /resetrepository %windir%\ sc config winmgmt start= auto
Thanks!