やじゅ@アプリケーション・ラボ わんくま支局

目次

Blog 利用状況

ニュース

プロフィール

MSMVP

caspol.exeを使用したセキュリティポリシーの設定

前記事 VSTOで、Outlook COMアドインのセットアップ
http://blogs.wankuma.com/yaju/archive/2009/06/08/174451.aspx

VSTOでOutlook COMアドインをインスール後に、セキュリティポリシーの設定
が必要なわけですが、その際に、セキュリティポリシーを設定するための
WSHスクリプトを作成しました。

バッチファイルで作成したかったんですが、レジストリの値を取得する方法が
いまいち分からなかったので(^^;

レジストリの値を取得するのは、インストール時にインストール先のフォルダパス
をレジストリに書き込むように設定してあるためです。


説明すると、セキュリティポリシーのコマンドラインツールであるCaspol.exeを
使って、セキュリティポリシーのユーザーのAll_Codeの配下に"VSTOAddin"
というグループを作成し、その下に"HOGE"の名前でURL先にインストール先の
フォルダパスをアクセス許可 FullTrustで設定してます。

caspolにてYes/Noの確認が出てくるのですが、入力させるのがわずらわしいので、
「echo y|%」を指定して、自動応答にしてます。
http://www.atmarkit.co.jp/fwin2k/win2ktips/731caclsy/caclsy.html

SecurityPolicy.vbsの中身

Option Explicit
'On Error Resume Next
dim WshShell,file
Set WshShell = WScript.CreateObject("WScript.Shell")

'RegReadメソッドで、レジストリ内の指定キーを取得(キーの分類については下記の表参照)。
file = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\HOGE\MailWatchAddinSetup\Path")

'セキュリティポリシー削除  既に存在してやり直したい場合(必要時のみ使用、現状はコメントアウト化)
'WshShell.Run "%comspec% /c echo y|%windir%\Microsoft.NET\Framework\v2.0.50727\caspol -user -remgroup VSTOAddin",,True

'セキュリティポリシー作成(All_Codeの配下にVSOAddinグループを作成、その配下にインストール先のセキュリティポリシー許可をセット)
WshShell.Run "%comspec% /c echo y|%windir%\Microsoft.NET\Framework\v2.0.50727\caspol -user -addgroup All_Code -allcode Nothing -n VSTOAddin",,True
WshShell.Run "%comspec% /c echo y|%windir%\Microsoft.NET\Framework\v2.0.50727\caspol -user -addgroup VSTOAddin -url " & Chr(34) & file & "*" & Chr(34) & " FullTrust -n HOGE",,True

投稿日時 : 2009年6月29日 2:19

コメントを追加

# Hello to every body, it's my first pay a quick visit of this web site; this webpage contains awesome and genuinely good stuff in support of visitors. 2019/04/04 14:12 Hello to every body, it's my first pay a quick vis

Hello to every body, it's my first pay a quick visit of this web site; this webpage contains
awesome and genuinely good stuff in support of visitors.

# Hi there, after reading this awesome article i am too glad to share my experience here with colleagues. 2019/05/15 15:10 Hi there, after reading this awesome article i am

Hi there, after reading this awesome article i am too glad to
share my experience here with colleagues.

# It's great that you are getting thoughts from this piece of writing as well as from our discussion made here. 2019/08/14 8:30 It's great that you are getting thoughts from this

It's great that you are getting thoughts from this piece
of writing as well as from our discussion made here.

# Hello, just wanted to say, I enjoyed this post. It was inspiring. Keep on posting! 2019/08/24 7:25 Hello, just wanted to say, I enjoyed this post. It

Hello, just wanted to say, I enjoyed this post.
It was inspiring. Keep on posting!

# It is truly a great and useful piece of information. I am satisfied that you just shared this helpful information with us. Please stay us up to date like this. Thanks for sharing. 2019/10/13 1:00 It is truly a great and useful piece of informatio

It is truly a great and useful piece of information. I
am satisfied that you just shared this helpful information with us.
Please stay us up to date like this. Thanks for sharing.

# Yesterday, while I was at work, my sister stole my iPad and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My iPad is now destroyed and she has 83 views. I know this is completely off topic but I had to share it 2019/11/11 9:14 Yesterday, while I was at work, my sister stole my

Yesterday, while I was at work, my sister stole my iPad
and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation.
My iPad is now destroyed and she has 83 views.
I know this is completely off topic but I had to share
it with someone!

# I'm really enjoying the theme/design of your weblog. Do you ever run into any internet browser compatibility issues? A small number of my blog readers have complained about my website not working correctly in Explorer but looks great in Safari. Do you h 2019/11/15 16:28 I'm really enjoying the theme/design of your weblo

I'm really enjoying the theme/design of your weblog.
Do you ever run into any internet browser compatibility issues?
A small number of my blog readers have complained about my website not working correctly in Explorer but
looks great in Safari. Do you have any tips to help fix this problem?

# Hi, just wanted to say, I liked this post. It was helpful. Keep on posting! 2019/11/30 6:25 Hi, just wanted to say, I liked this post. It was

Hi, just wanted to say, I liked this post. It was helpful.

Keep on posting!

# You really make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complex and extremely broad for me. I'm looking forward for your next post, I'll try to get the 2019/11/30 6:37 You really make it seem so easy with your present

You really make it seem so easy with your presentation but I find
this topic to be actually something which I think I would never understand.
It seems too complex and extremely broad for me.
I'm looking forward for your next post, I'll try to get the hang
of it!

# Why viewers still use to read news papers when in this technological globe all is presented on net? 2019/12/16 5:58 Why viewers still use to read news papers when in

Why viewers still use to read news papers when in this
technological globe all is presented on net?

# 2 Publication Date DP Every statistic has 4 2020/01/01 0:55 Typicalcat48

http://socledumonde.org/%ef%bb%bfmature-dating-online-sites-no-charge/ the uk iranian seniors dating online service http://marriance.fr/no-register-senior-singles-dating-online-site-blogs.wankuma.com.pdf dallas nigerian mature dating online service

# Hi, yeah this post is really fastidious and I have learned lot of things from it about blogging. thanks. 2020/06/22 12:47 Hi, yeah this post is really fastidious and I have

Hi, yeah this post is really fastidious and I have learned lot
of things from it about blogging. thanks.

# This can be a topic which is close to my heart... Best wishes! Precisely where are the contact info though? 2020/09/25 21:58 This can be a topic which is close to my heart...

This can be a topic which is close to my heart... Best wishes!
Precisely where are the contact info though?

タイトル  
名前  
URL
コメント