Freigeben über


Giving full trust to a network share

Tan's post reminded me that I never got around to posting this silly batch script that I use.  As you can see with Tan's example, you can call this with just a hostname, or hostname/sharename, or whatever. 

For both of us, we're ripping off Shawn's original blog post on the topic that gives more details on the command's parameters.

 C:\ # gcm fulltrustserver|cat
@echo off
setlocal

pushd %Systemroot%\Microsoft.NET\Framework
for /r /d %%d IN (v*) do (
    if exist %%d\caspol.exe (
        %%d\caspol.exe -q -m -ag 1.2 -url file://%1/* FullTrust
        echo Successful caspol run in %%d
        set FOUND=1
    )
)
popd

if not defined FOUND (
    echo FAILED TO FIND CASPOL.EXE
    exit /b 1
) else (
    exit /b 0
)
C:\ #

Sorry for the total lack of creativity in the subject, copy-pasting Tan's is too easy for my lazy self. :)