Wednesday, November 17, 2021

[SOLVED] Mount Point in PowerShell

Issue

I'm trying to create a mount point using Powershell. it's done locally, and here is the code & issue i'm having.

$choice = "t"
New-Item -ItemType directory -Path "E:\Data\Riptide\Ariis\Ris\Docs\interPrimary1\"
$orgdrive = "E:\Data\Riptide\Ariis\Ris\Docs\interPrimary1\"
$driveLetter= $Choice + ":\"
$driveinfo=get-wmiobject win32_volume | where { $_.driveletter -eq $choice + ":" } | select-object DeviceID
Mountvol $orgdrive $driveinfo

When executed, I get that the parameter is incorrect.

Thanks in advance.


Solution

You just have to try :

mountvol $orgdrive $driveinfo.DeviceID

For the future you can test :

$driveinfo| Get-Member

You can find here a tool that allow you to test the command line parameters.



Answered By - JPBlanc