Appendix B - MarkHBIandProtect Windows PowerShell Script

Applies To: Windows Server 2008, Windows Server 2008 R2

The following Windows Powershell script is used to create the file management task to restrict files to only full-time employees.


# execute bulk tool
$encryptfile = '"' + $args[0] + '"'
$owneremail = $args[1]
if ($owneremail -eq "[Source")
{
    $owneremail = $args[5]
}
$r = start-process –Wait –PassThru –FilePath C:\Windows\SysWOW64\RmsBulk.exe –ArgumentList “/encrypt”, $encryptfile, “\\adrms.fabrikam.com\ADRMSPublic\Fabrikam_FTE_Confidential.xml”, $owneremail, “/log”, “C:\FabrikamDocuments\RmsLog.log”, “/append”, “/preserveattributes”
if ($r.ExitCode –eq 0)
{
    $c = new-object –com Fsrm.FsrmClassificationManager
    $d = (get-date).toFileTimeUTC()
    $d = $d - ($d % 10000000)
    $c.SetFileProperty($args[0], “dateEncrypted”, $d.ToString())
}