How to create a mount point with PowerShell

Hello,
Can you please point me to a sample which creates a mount point using powershell?

Try this. I cooked it up by consolidating a few different sources.  I posted it on the microsoft connect suggestion for native support, under workarounds:
https://connect.microsoft.com/PowerShell/feedback/details/627099/need-powershell-equivalent-to-cmds-mklink
#symlinks.ps1
# First add a type so it stays available for this instance
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
namespace mklink
public class symlink
[DllImport("kernel32.dll")]
public static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
[DllImport("kernel32.dll")]
public static extern bool RemoveDirectory(string lpPathName);
[DllImport("kernel32.dll")]
public static extern uint GetLastError();
Function New-ReparsePoint() {
<#
.SYNOPSIS
Creates a reparse point to the specified target.
.DESCRIPTION
Creates a reparse point to the specified target.
.PARAMETER Path
Path to the reparse point to remove.
.NOTES
Author: Jordan Mills
Version: 1.0
.EXAMPLE
Remove-SymbolicLink -Path "E:\directory\mount"
#>
[cmdletbinding(DefaultParameterSetName="default")]
Param (
[parameter(
ParameterSetName="default",
Position=0,
Mandatory=$true,
ValueFromPipeLine=$True,
ValueFromPipelineByPropertyName=$True
[parameter(
ParameterSetName="file",
Position=0,
Mandatory=$true,
ValueFromPipeLine=$True,
ValueFromPipelineByPropertyName=$True
[parameter(
ParameterSetName="directory",
Position=0,
Mandatory=$true,
ValueFromPipeLine=$True,
ValueFromPipelineByPropertyName=$True
[Alias("Path","FileName","Directory")]
[string[]]$Name,
[parameter(
ParameterSetName="default",
Position=1,
Mandatory=$true,
ValueFromPipelineByPropertyName=$True
[parameter(
ParameterSetName="file",
Position=1,
Mandatory=$true,
ValueFromPipelineByPropertyName=$True
[parameter(
ParameterSetName="directory",
Position=1,
Mandatory=$true,
ValueFromPipelineByPropertyName=$True
[string]$TargetPath,
[parameter(
ParameterSetName="file",
Position=2,
Mandatory=$false,
ValueFromPipelineByPropertyName=$True
[switch]$IsFile,
[parameter(
ParameterSetName="directory",
Position=2,
Mandatory=$false,
ValueFromPipelineByPropertyName=$True
[switch]$IsDirectory
If ($IsFile -or $IsDirectory) {
If($IsFile) {
$result = [mklink.symlink]::CreateSymbolicLink($Name,$TargetPath,0)
Else {
If($IsDirectory) {
$result = [mklink.symlink]::CreateSymbolicLink($Name,$TargetPath,1)
Else {
Write-Error -Message "Conflicting path type parameters. This should not happen."
Break;
Else {
If (Test-Path -LiteralPath $TargetPath -PathType Leaf -ErrorAction SilentlyContinue) {
$result = [mklink.symlink]::CreateSymbolicLink($Name,$TargetPath,0)
Else {
If (Test-Path -LiteralPath $TargetPath -PathType Container -ErrorAction SilentlyContinue) {
$result = [mklink.symlink]::CreateSymbolicLink($Name,$TargetPath,1)
Else {
Write-Error -Message "Unable to determine path type of TargetPath. Use -IsFile or -IsDirectory."
Break;
If ($result) {
Get-Item $Name
} Else {
Write-Error -Message "Error creating symbolic link" -Category WriteError #-ErrorId $([mklink.symlink]::GetLastError())
Function Remove-ReparsePoint {
<#
.SYNOPSIS
Removes a file or directory that is a reparse point (symlink or hardlink) without removing all child objects.
.DESCRIPTION
Removes a file or directory that is a reparse point (symlink or hardlink) without removing all child objects.
.PARAMETER Path
Path to the reparse point to remove.
.NOTES
Author: Jordan Mills
Version: 1.0
.EXAMPLE
Remove-SymbolicLink -Path "E:\directory\mount"
#>
[cmdletbinding()]
Param (
[parameter(
Position=0,
Mandatory=$true,
ValueFromPipeLine=$True,
ValueFromPipelineByPropertyName=$True
[Alias("FullName","Name","FileName","Directory")]
[ValidateScript({Test-Path $_})]
[string[]]$Path
$Path |
Get-Item |
ForEach-Object {
$Item = $_;
Switch ($Item.Attributes -band ([IO.FileAttributes]::ReparsePoint -bor [IO.FileAttributes]::Directory)) {
([IO.FileAttributes]::ReparsePoint -bor [IO.FileAttributes]::Directory) {
# Is reparse directory / symlink
If ($whatif) {
Write-Host "What if: Performing the operation `"Delete Directory`" on target `"$($_.FullName)`""
} Else {
[System.IO.Directory]::Delete($Item.FullName);
Break;
([IO.FileAttributes]::ReparsePoint -bor 0) {
# Is reparse file / hardlink
If ($whatif) {
Write-Host "What if: Performing the operation `"Delete File`" on target `"$($_.FullName)`""
} Else {
[System.IO.File]::Delete($Item.FullName);
Break;
default {
Write-Error "$Item is not a reparse point."

Similar Messages

  • How to create an azure website with PowerShell?

    Hello
    I'm, trying to create a new wordpress website in Azure with PowerShell, I saw a video: https://www.youtube.com/watch?v=LHjkn59Lf0g
    But, When execute my code, I get the following error:
    New-AzureResourceGroup :
    06:42:41 p. m. - Resource SuccessBricks.ClearDB/databases 'dbdb3' failed with message 'User
    failed validation to purchase resources. Error message: '["Credit Card is the only supported payment instrument for
    purchases"]''
    What Can I do?
    I have a bizspark subscription with enough money :S
    THANKS!

    Hi Victor,
    Thanks for your question.
    Firstly, I recommend you to create the website and recourse group in Azure portal to see if the issue persists.
    In addition, I will have a test for this and feedback to you later. Appreciate your patience.
    Best regards,
    Susie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to create an Access Point with Two MI424WR (GigE for Verizon FiOS) Routers?

    I understand that these routers are fairly new and I cannot seem to find hardly any information on them.  I have a fairly large home and I just happen to have two MI424WR's Gig E routers.  One is my main and the other I would like to create into an Access Point.  Has anyone done this with these routers?  I have found plenty of previous information on previous routers similar to these, but I have yet to find any instructions on how to do this with these routers. 
    Please help!
    Mark
    http://www.actiontec.com/products/product.php?pid=214

    How are you going to connect them?  cat5 or coax?
    cat5 instructions:
    Can I use my wireless or an extra router along with the Verizon provided router?
    coax instructions:
    Can I get an ethernet connection in a room with only coax?

  • How to determine the mount point for directory /tmp ?

    Folks,
    Hello. I am installing Oracle 11gR2 RAC using 2 Virtual Machines (rac1 and rac2 whose OS are Oracle Linux 5.6) in VMPlayer and according to the tutorial
    http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html
    I am installing Grid infrastructure. I am on step 7 of 10 (verify Grid installation enviroment) and get this error:
    "Free Space: Rac2: /tmp"
    Cause: Could not determine mount point for location specified.
    Action: Ensure location specified is available.
    Expected value: n/a
    Actual value: n/a
    I have checked the free space using the command:
    [root@Rac2 /]# df -k /tmp
    Output:
    Filesystem     1k-blocks     used     Available     Use%     Mounted on
    /dev/sda1     30470144     7826952     21070432     28%     /
    As you see above, the free space is enough, but could not determine mount point for /tmp.
    Do any folk understand how to determine the mount point for directory /tmp ?
    Thanks.

    I have just checked "/home/oracle/.bash_profile". But in my computer, there is no "oracle" under /home directory.Is this your first time Linux and Oracle installation? I had a brief look at your referenced link. The reason why you do not find a "oracle" user is because the instructions use "ora11g" instead, which, btw, is not standard. The directories of your installation and your installation source can be somewhat different from known standards and you will have to adjust it to your system.
    My best guess is that you have either missed something in the instructions or you need to ask the author of the blog what is wrong. The chance to find someone here who has experience with these custom instructions is probably unlikely.
    I suggest you try to locate the cluster verification tool, which should be in the bin directory of your grid installation. Alternatively you might want to check the RAC, ASM & Clusterware Installation forum: RAC, ASM & Clusterware Installation

  • How to create  a test plan with specific transactions (or program)

    Hello,
    I'm a new user in Sol Man !
    How to create  a test plan with specific transactions (or program).
    In my Business Blueprint (SOLAR01) I've created in 'transaction tab' the name of my specific transactions and linked it.
    In my test plan (STWB_2) those specific doesn't appear to be selected !
    Thanks in advance.
    Georges HUYNEN

    Hi 
    In solar01 you have defined but you have to assign the test case in solar02 for this test case in the test cases tab.
    When you do so expand the business sceanario node in test plan generation of STWB_2 transaction and now that will appear.
    Also visit my weblog
    /people/community.user/blog/2006/12/07/organize-and-perform-testing-using-solution-manager
    please reward points.

  • How to create an unsolved cube with awm???

    hi all,
    I readed the "Oracle Olap developer's guide to the Oalp api" and I found there's 2 type of Cube: Solved and Unsolved Cubes. And this document says: "... if all the data for a cube is specified by the DBA, then the cube is considered to be Solved. If some or all of the aggregate data must be calculated by Oracle OLap, then the cube is unsolved ..."
    I tried with awm 10.2.0.3.0A to create an unsolvedCube but I can't. All cubes I created are solvedCube. To know if a cube is solved or unsolved, I wrotte an program in Java to read informations of package mtm.
    Some one can tell me how to create an unsolved cube with AWM ou other soft please!

    SH is not a relational OLAP data model which is quite different from the GLOBAL schema which is based on an Analytic Workspace.
    If you change the aggregation method you will need to re-compute the whole cube which can be a very big job! You might be able to force the unsolved status be de-selecting all the levels on the Rules tab in AWM. However, I think by default analytic workspace OLAP models always provide a fully solved cube to the outside world. This is the nature of the multi-dimensional model.
    Relationally, as keys are located in separate columns a cube can be unsolved in that the key column only contains values for a single level from the corresponding dimension tables. If more than keys for different levels within the same dimension appear within the fact key column then the cube is deemed as being solved.
    Therefore, I am not sure you are going to get the information you require from the API. To changes the aggregation method you will have to switch off all pre-compute options and also disable the session cache to prevent previously calculated data being returned when you change the aggregation method.
    Hope this helps
    Keith Laker
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

  • How to create a pdf file with CS5

    Hello, I'm new to PhotoShop CS5 and haven't figured out yet (despite two hours of trying) how to create a pdf file with pictures and texts.  Can someone please help me with this ?  The "help" button in CS5 doesn't seem to cover this question.  Nor do the FAQs.
    Thank you very much.

    Save As... Photoshop PDF.

  • How to create a web template with company logo

    how to create a web template with company logo . can any one help me with the steps. or any notes. thnaks in advance .
    2. i have 25000 articles and client want to have a selection feild to see top article ex:50,10,20, 100, 1000 etc . same for bottom articles . plz let me know how to do it . thanks for replay . i am new bw so plz .
    thanks to you all

    Hi
    1) Please read
    http://help.sap.com/saphelp_nw04/helpdata/en/4a/c8353c51aab32be10000000a114084/frameset.htm
    2) Create a condition in the Query Designer: Use a formula variable
    See http://help.sap.com/saphelp_nw04/helpdata/en/73/702e39074dc93de10000000a114084/frameset.htm
    Heike

  • How to create a transport request with query and only with its structure.

    HI guru,
                how to create a transport request with query and only with its structure.transport request should not  include any other query items like ( variables, conditions...etc)
    thanks in advance.
    venkata

    Hi,
    Goto RSA1 and then Transport Connection -> In SAP Transports select Object Types-> Query Elements -> Then select Query->Give Technical name of the query and then select for transfer. In the right side you can choose the components which you wanted to transport.
    Regards,
    anil

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • How to create a procedure function with a return value of ref cursor?

    Can anybody provide a sample about how to create a procedure function with a return value of REF CURSOR?
    I heard if I can create a function to return a ref cursor, I can use VB to read its recordset.
    Thanks a lot.

    http://osi.oracle.com/~tkyte/ResultSets/index.html

  • Creating new mount points on pre installed Solaris 2.7

    Creating new mount points on pre installed Solaris 2.7

    Hi,
    Thanks for suggestion.
    I have checked note 1521371, so as per note I have to provide the locations as given below..
    For PI1 (i.e. PI Development)...............
    Oracle Base Location : /oracle/PI1
    Oracle Home Location : /oracle/PI1/112_64
    Inventory Directory : /oracle/PI1
    For PI2 (i.e. PI Production)...............
    Oracle Base Location : /oracle/PI2
    Oracle Home Location : /oracle/PI2/112_64
    Inventory Directory : /oracle/PI2
    Correct me if I am wrong..
    Could you please tell me, does we need to set the ORACLE environmental variables i.e. ORACLE_BASE, ORACLE_HOME and ORACLE_STAGE before start the ORACLE database installation?
    Kindly suggest,
    Thanks and regards,
    Amit....

  • How to create an install cd with the final cut pro x app if the app comes from App.Store?

    How to create an install cd with the final cut pro x app if the app comes from App.Store?

    Just copy the Application FCPX to your CD. When you want to install drag the FCPX to the Application folder and you are done.

Maybe you are looking for

  • Text is not saved in file...WHY ?

    Hi everyone, I made a simple text editor using Swing. It has only a JTextArea as the main text processor. I have added a File menu where I can open or save files with the JFileChooser class. The code I am using to save data from the JTextArea to a te

  • Today update osx 10.6.8 to apple new 1.5gb release and macbookpro don't reboot

    hi there averyone. I updated today (9.30 gmt+1) my macbookpro os 10.6.8 to apple latest release and after 1 required reboot my apple macbookpro is deeply thinking on a gray apple with a loader under it... Apple can provide a fast solution? Are apple

  • Can user update the 6i canned Reports output in any format?

    Hi, We are converting the existing 2.5 reports to 6i reports and our users requested a functionality to update the output of the canned reports. I can generate the output in PDF, RTF, HTML, XML from the developer and view it but cannot update the inf

  • KMC Plug-in for NWDS 7.3

    Hello all, According to OSS Note1572813 the KMC Plugin for NWDS 7.3 is deliverd separatelly. The link provided by SAP for downloading the plugin does not work. Would you please help me find a way to download this plug-in? Thank you very much!! I woul

  • Yoga 2 Bluetooth not stable with 7260 AC card

    Hi everyone, I'm having a problem with my Microsoft Wireless Bluetooth 8000 presenter mouse staying connected via Bluetooth.  I have installed the latest Kona Wifi driver and the latest Bluetooth driver from the Lenovo site.  It's my opinion that the