4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ユーザー権限でシンボリックリンクを作成できるようにする

Last updated at Posted at 2019-06-09

Professional Edition以上のみ

  1. 『グループポリシーの編集』を開く
  2. 『コンピュータの構成』→『Windowsの設定』→『セキュリティの設定』→『ローカルポリシー』→『ユーザー権利の割り当て』を開く
  3. 『シンボリックリンクの作成』を開き、ユーザー権限で作りたいユーザー or グループを追加する。

要再起動

試してみる

ユーザー権限追加前

PS G:\tmp> echo "this is test" > h:/tmp/test.txt
PS G:\tmp> New-Item -Type SymbolicLink -Value H:\tmp\test.txt -Path . -Name test.txt
New-Item : Administrator privilege required for this operation.
At line:1 char:1
+ New-Item -Value H:\tmp\test.txt -Path . -Name test.txt -Type Symbolic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (H:\tmp\test.txt:String) [New-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : NewItemSymbolicLinkElevationRequired,Microsoft.PowerShell.Commands.NewItemCommand

PS G:\tmp>

ユーザー権限追加後

PS G:\tmp> New-Item -Type SymbolicLink -Value H:\tmp\test.txt -Path . -Name test.txt


    Directory: G:\tmp

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---l        2019/06/09    15:03              0 test.txt

PS G:\tmp> (ls .\test.txt).LinkType
SymbolicLink
PS G:\tmp> (ls .\test.txt).Target
H:\tmp\test.txt
PS G:\tmp> cat .\test.txt
this is test
PS G:\tmp>

New-Itemの最初の引数を -Type SymnbolicLink -Value H:\tmp\test.txt にすると ln と間違いづらいかも

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?