プロジェクト

全般

プロフィール

フォルダアクセス件の一覧を出力する » 履歴 » バージョン 4

バージョン 3 (蒲池 晃, 2023/05/17 02:53) → バージョン 4/5 (蒲池 晃, 2023/05/17 02:53)

h1. フォルダアクセス件の一覧を出力する

■ フォルダのアクセス権限一覧を出力する

文字コードをUTFで指定
C:\office.csvにデータを出力
上位三階層までを表示する

<pre>
Get-ChildItem -Force -Recurse -Depth 3 | Where-Object { $_.mode -match "d" } | Get-Acl | Select-Object @{Label="Path"; Expression={Convert-Path $_.Path}}, Owner, AccessToString | Export-Csv C:\office.csv -Encoding UTF8
</pre>

Powershellで、調べたい階層まで移動してから実行する

■ active dirctory のグループメンバーリストを出力する

<pre>
Get-ADGroup -Filter *|
select Name, @{Label = "MemberNames"; Expression = {($_| Get-ADGroupMember| select -ExpandProperty Name) -join ","}}|
Format-List
</pre>

コマンドプロンプトでローカルユーザーにADMIN権限を付与 コマンドプロンプトでローカルユーザーに権限を付与

<pre>
net localgroup administrators user /add
</pre>