Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fbdbd7c

Browse files
install script progress
1 parent 236a59c commit fbdbd7c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎install.ps1‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Write-Host 'creating kptnhook directories @ C:\kptnhook if not exists'
2+
md -Force 'C:\kptnhook'
3+
md -Force 'C:\kptnhook\Ship'
4+
md -Force 'C:\kptnhook\Data'
5+
6+
function allow-dir {
7+
param ([string]$path, [string]$ident)
8+
9+
#$user = [Security.Principal.NTAccount]::new($ident).Translate([System.Security.Principal.SecurityIdentifier])
10+
$user = [Security.Principal.NTAccount]::new("ALL RESTRICTED APPLICATION PACKAGES").Translate([System.Security.Principal.SecurityIdentifier])
11+
Write-Host $user
12+
$rule = [Security.AccessControl.FileSystemAccessRule]::new($user, "ReadAndExecute", "Allow")
13+
$acl = Get-Acl $path
14+
$acl.SetAccessRule($rule)
15+
Set-Acl -Path $path -AclObject $acl
16+
}
17+
18+
foreach($path in Get-ChildItem 'C:\kptnhook') {
19+
allow-dir $path 'ALL RESTRICTED APPLICATION PACKAGES'
20+
# allow-dir $path 'EVERYONE'
21+
}
22+
23+
$NewAcl = Get-Acl -Path 'C:\kptnhook'
24+
# Set properties
25+
$identity = "BUILTIN\Everyone"
26+
$fileSystemRights = "Read"
27+
$type = "Allow"
28+
# Create new rule
29+
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
30+
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
31+
# Apply new rule
32+
$NewAcl.SetAccessRule($fileSystemAccessRule)
33+
Set-Acl -Path 'C:\kptnhook' -AclObject $NewAcl

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /