0

Is there a way to move item using ID in powershell.

I know there is a way to Move item using path

 Move-Item -Path $_.ItemPath -Destination $destinationContainer;

But in my scenario, the path is same for multiple forms, so I would need to move item via ID.

Is this something possible via powershell?

1

3 Answers 3

3

You can also use ID for both source and destination. So the query will be something like this.

$itemID = "{8A87AC2B-210D-49F2-93FC-215918085418}" # Mention your Item ID to move
$desinationParentID = "{F0C8DEC1-75FB-4633-BA98-71CCD91F18F1}" # Mention your Parent Item ID where to move

Get-Item -Path "master:" -ID "$itemID" | Move-Item -Destination "master:$desinationParentID"
0

Yes, but you need to get item first

Get-Item . -ID $itemID | Move-Item -Destination $destinationContainer

If you are not sure if something is possible with given cmdlet run

Get-Help Move-Item

or find examples in the documentation

0

Yes, you can actually pass in the ID of the item instead of the string path.

Move-Item -Path $_.ID -Destination $destinationContainer;

So, $_.ID instead of $_.ItemPath

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.