Create

Creates a new instance of the Win32_DFSNode class.

Creates a new instance of the Win32_DFSNode class.

Example

Do not run below example code just to see what happens next. Many methods seriously affect your system. Always make sure you actually understand what the method and the code do.

# define the arguments you want to submit to the method
# remove values that you do not want to submit
# make sure you replace values with meaningful content before running the code
# see section "Parameters" below for a description of each argument.
$arguments = @{
    Description     = 'someText'  # replace 'someText' with meaningful text
    DfsEntryPath    = 'someText'  # replace 'someText' with meaningful text
    ServerName      = 'someText'  # replace 'someText' with meaningful text
    ShareName       = 'someText'  # replace 'someText' with meaningful text
}


Invoke-CimMethod -ClassName Win32_DFSNode -Namespace Root/CIMV2 -MethodName Create -Arguments $arguments |
Add-Member -MemberType ScriptProperty -Name ReturnValueFriendly -Passthru -Value {
  switch ([int]$this.ReturnValue)
  {
        0        {'Success'}
        default  {'Unknown Error '}
    }
}

To run this method on one or more remote systems, use New-CimSession:

$ComputerName = 'server12','server14'  # adjust to your server names
$Credential   = Get-Credential         # submit a user account with proper permissions

# define the arguments you want to submit to the method
# remove values that you do not want to submit
# make sure you replace values with meaningful content before running the code
# see section "Parameters" below for a description of each argument.
$arguments = @{
    Description     = 'someText'  # replace 'someText' with meaningful text
    DfsEntryPath    = 'someText'  # replace 'someText' with meaningful text
    ServerName      = 'someText'  # replace 'someText' with meaningful text
    ShareName       = 'someText'  # replace 'someText' with meaningful text
}


$session = New-CimSession -ComputerName $ComputerName -Credential $Credential

Invoke-CimMethod -ClassName Win32_DFSNode -Namespace Root/CIMV2 -MethodName Create -Arguments $arguments -CimSession $session |
Add-Member -MemberType ScriptProperty -Name ReturnValueFriendly -Passthru -Value {
  switch ([int]$this.ReturnValue)
  {
        0        {'Success'}
        default  {'Unknown Error '}
    }
}


Remove-CimSession -CimSession $session

Learn more about Invoke-CimMethod and invoking WMI methods.

Syntax

uint32 Create(
  [in]           string DFSEntryPath,
  [in]           string ServerName,
  [in]           string Sharename,
  [in, optional] string Description
);

Parameters

Name Type Description
Description String The Description parameter specifies a comment describing the node.
DfsEntryPath String The DfsEntryPath parameter specifies the path of the DFS root.
ServerName String The ServerName parameter specifies the name of the server that hosts the share to which the link is associated. For example, in order to create a link associated to a share “\myserver\myshare”, the ServerName parameter should be set to “\myserver”.
ShareName String The ShareName parameter specifies the name of the share to which the link is associated with. For example, in order to create a link associated to a share “\myserver\myshare”, the ShareName parameter should be set to “myshare”.

Return Value

Returns a value of type UInt32. Return values:

$returnValues = @{
    0    = 'Success'
}

Requirements

To use Win32_DFSNode, the following requirements apply:

PowerShell

Get-CimInstance was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.

If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.

Operating System

Win32_DFSNode was introduced on clients with Windows Vista and on servers with Windows Server 2008.

Namespace

Win32_DFSNode lives in the Namespace Root/CIMV2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance.

Implementation

Win32_DFSNode is implemented in Wmipdfs.dll and defined in Wmipdfs.mof. Both files are located in the folder C:\Windows\system32\wbem:

explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\Wmipdfs.mof