Có vẻ như bạn sẽ làm điều đó bằng WMI.
Nhận một thể hiện của: Win32_DCOMApplicationSetting
như thế này:
$dcom = Get-WMIObject -Class Win32_DCOMApplicationSetting -Filter 'Description="Something"'
Bây giờ bạn có quyền truy cập vào các SetAccessSecurityDescriptor
và SetLaunchSecurityDescriptor
phương pháp.
Từ: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384905(v=vs.85).aspx ứng dụng
DCOM
trường ứng dụng DCOM có một vài mô tả bảo mật. Bắt đầu từ với Windows Vista, sử dụng các phương thức của lớp Win32_DCOMApplicationSetting để nhận hoặc thay đổi các mô tả bảo mật khác nhau. Bảo mật các bộ mô tả được trả về dưới dạng các thể hiện của lớp Win32_SecurityDescriptor .
Để nhận hoặc thay đổi quyền cấu hình, hãy gọi phương thức GetConfigurationSecurityDescriptor hoặc SetConfigurationSecurityDescriptor.
Để nhận hoặc thay đổi quyền truy cập, hãy gọi phương thức GetAccessSecurityDescriptor hoặc SetAccessSecurityDescriptor.
Để nhận hoặc thay đổi quyền khởi động và kích hoạt, hãy gọi phương thức GetLaunchSecurityDescriptor hoặc SetLaunchSecurityDescriptor.
Windows Server 2003, Windows XP, Windows 2000, Windows NT 4.0 và Windows Me/98/95: Win32_DCOMỨng dụngCài đặt bảo mật các phương pháp mô tả không khả dụng.
Ngoài ra còn có một công cụ gọi là DCOMPERM trong đó mã nguồn có sẵn trong Windows SDK: http://www.microsoft.com/en-us/download/details.aspx?id=8279
Bạn có thể tìm thấy phiên bản biên soạn xung quanh trực tuyến nếu bạn tìm kiếm DCOMPERM biên soạn.
Dưới đây là các tùy chọn dòng lệnh:
Syntax: dcomperm <option> [...]
Options:
Modify or list the machine access permission list
-ma <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r"]
-ma list
Modify or list the machine launch permission list
-ml <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r,ll,la,rl,ra"]
-ml list
Modify or list the default access permission list
-da <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r"]
-da list
Modify or list the default launch permission list
-dl <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r,ll,la,rl,ra"]
-dl list
Modify or list the access permission list for a specific AppID
-aa <AppID> <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r"]
-aa <AppID> default
-aa <AppID> list
Modify or list the launch permission list for a specific AppID
-al <AppID> <"set" or "remove"> <Principal Name> ["permit" or "deny"] ["level:l,r,ll,la,rl,ra"]
-al <AppID> default
-al <AppID> list
level:
ll - local launch (only applies to {ml, dl, al} options)
rl - remote launch (only applies to {ml, dl, al} options)
la - local activate (only applies to {ml, dl, al} options)
ra - remote activate (only applies to {ml, dl, al} options)
l - local (local access - means launch and activate when used with {ml, dl, al} options)
r - remote (remote access - means launch and activate when used with {ml, dl, al} options)
Cảm ơn Andy, điều đó đã giúp ích rất nhiều! Cuối cùng tôi đã sử dụng một hỗn hợp của cả hai phương pháp. Tôi đã sử dụng Win32_DCOMApplicationSetting để lấy các id ứng dụng, và sau đó sử dụng DComPerm để thêm các quyền cần thiết. Một cái gì đó tôi thấy một chút kỳ lạ là CMD chạy DcomPerm với rất ít vấn đề hơn Powershell, vì vậy để đạt được những gì tôi cần, tôi đã viết một tập tin thực thi mà một số biến đã được thông qua, và được gọi là từ Powershell. – Vermin
@Việc đoán của tôi sẽ là vấn đề bạn gặp phải với PowerShell có lẽ là cú pháp phân tích cú pháp dòng lệnh/cú pháp. Có thể đăng lỗi bạn nhận được? –