3

This seems like a simple problem but I am unable to fix it

Running dfsutil command in shell returns result

C:\Windows\system32>dfsutil link "\server.domain.com\DFSRootname\Sharename"

Link Name="Sharename" State="OK" Timeout="1800" Target="\server1\sharename" State="ONLINE" [Site: site1] Target="\server2\sharename" State="OFFLINE" [Site: site2]

Done processing this command.

Trying to do the same in powershell


PS>
$path = "\\server.domain.com\DFSRootname\Sharename"
$dfsutil = "dfsutil"
$option = "link"

PS C:\Windows\system32> dfsutil link $path

DFS Utility Version 5.2 (built on 5.2.3790.3959)
Copyright (c) Microsoft Corporation.  All rights reserved.

Unrecognized option "ink"

Same with using Invoke-Expression

PS C:\Windows\system32> Invoke-Expression "$dfsutil $option $path"

DFS Utility Version 5.2 (built on 5.2.3790.3959)
Copyright (c) Microsoft Corporation. All rights reserved.

Unrecognized option "ink"


Sergei
  • 1,226
  • 16
  • 25

2 Answers2

3

The following syntax works for me on PS v2/v3. I'm preceding the command with a & the Call Operator:

$path = "\\ad.example.org\root\share"
$dfsutil = "dfsutil"
$option = "link"

& $dfsutil $option $path

Link Name="share" State="OK" Timeout="1800"
Target="\\fs1.example.org\share" State="ONLINE"  [Site: default-site]

Done processing this command.
jscott
  • 24,484
  • 8
  • 79
  • 100
  • Thank you Scott. This is what I expected to happen. Seems like problem only happens on my Windows 7 PS3 install. Command works fine on Windows 2008 R2 host wint PS2 it works fine – Sergei Jun 13 '13 at 13:09
0

Seems like installation problem with my Windows 7 PS3 install. Command works fine on Windows 2008 R2 host with PS2

Sergei
  • 1,226
  • 16
  • 25