Configuring File Screen Template command actions via powershell

Hello everyone,

I am trying to configure File Server Resource Manager via powershell.  I am having problems creating a new File Screen Template with a command action.  I would like the command to run a BAT file and pass the [Source Io Owner] variable as an argument to the BAT file.  I have tried placing my BAT file in various locations due to the "0x80045317, The specified path is insecure" error but I also get a "0x8004530d, The specifiec property is out of range".  I also get this error when I run the cmd.exe command and invoke my BAT file through arguments.  I have researched this errors extensively and there is little to no details about what would be causing them online so I am turning to these discussions as a last resort.  Here are the powershell commands I have tried and their results:

PS C:\Users\Administrator> $notification2 = new-fsrmaction command -Command "C:\gradea\crypto.bat" -CommandParameters "[
Source Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1
PS C:\Users\Administrator> new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification2
 -Active:$false
new-fsrmfilescreentemplate : 0x80045317, The specified path is insecure.
At line:1 char:1
+ new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FsrmFileScreenTemplate:Root/Microsoft/...eScreenTemplate) [New-FsrmF
   ileScreenTemplate], CimException
    + FullyQualifiedErrorId : HRESULT 0x80045317,New-FsrmFileScreenTemplate

PS C:\Users\Administrator> $notification2 = new-fsrmaction command -Command "C:\crypto.bat" -CommandParameters "[Source
Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1
PS C:\Users\Administrator> new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification2
 -Active:$false
new-fsrmfilescreentemplate : 0x8004530d, The specified property is out of range.
At line:1 char:1
+ new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FsrmFileScreenTemplate:Root/Microsoft/...eScreenTemplate) [New-FsrmF
   ileScreenTemplate], CimException
    + FullyQualifiedErrorId : HRESULT 0x8004530d,New-FsrmFileScreenTemplate

PS C:\Users\Administrator> $notification2 = new-fsrmaction command -Command "C:\temp\crypto.bat" -CommandParameters "[So
urce Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1
PS C:\Users\Administrator> new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification2
 -Active:$false
new-fsrmfilescreentemplate : 0x80045317, The specified path is insecure.
At line:1 char:1
+ new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FsrmFileScreenTemplate:Root/Microsoft/...eScreenTemplate) [New-FsrmF
   ileScreenTemplate], CimException
    + FullyQualifiedErrorId : HRESULT 0x80045317,New-FsrmFileScreenTemplate

PS C:\Users\Administrator> $notification2 = new-fsrmaction command -Command "C:\WINDOWS\system32\cmd.exe" -CommandParame
ters "/c C:\gradea\crypto.bat [Source Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1
PS C:\Users\Administrator> new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification2
 -Active:$false
new-fsrmfilescreentemplate : 0x8004530d, The specified property is out of range.
At line:1 char:1
+ new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FsrmFileScreenTemplate:Root/Microsoft/...eScreenTemplate) [New-FsrmF
   ileScreenTemplate], CimException
    + FullyQualifiedErrorId : HRESULT 0x8004530d,New-FsrmFileScreenTemplate

Does anyone have an idea why I get the 0x80045317 or 0x8004530d errors?

Thanks in advance,

Phil

July 22nd, 2015 3:54pm

Hi Phil,

What's the content of the file C:\gradea\crypto.bat? We may need this file for testing the issue.

Also can you run the cmdlet "new-fsrmaction command -Command "C:\gradea\crypto.bat" -CommandParameters "[Source Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1" directly?

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 9:03am

Hi Shaon,

The contents of c:\gradea\crypto.bat is pretty simple:

pwershell.exe -executionpolicy bypass -file "C:\gradea\getinfo.ps1" -DomainUser %1

Configuring the File Screen Template's Command action via the GUI work perfectly.  I specify "c:\gradea\crypto.bat" in the "Run this command or script:" field and add "[Source Io Owner]" to the "Command Arguments" field and specify to run the command as Local System and everything works.  It's via powershell that I am unable to configure the command action properly.

Running ""new-fsrmaction command -Command "C:\gradea\crypto.bat" -CommandParameters "[Source Io Owner]" -SecurityLevel LocalSystem -RunLimitInterval 1" works fine but when I saving the command's array output into a variable and pipe the variable into the "new-fsrmscreentemplate" command and set the notification option to use the variable's contents, i get the "0x8004530d, The specified property is out of rang" error.

July 23rd, 2015 1:40pm

Also I've realized that the "0x80045317, The specified path is insecure." is by design.  SRMSVC generates event id 12300 that states that 'BUILTIN\Users' has write access to 'C:\GradeA\' and to move the file to a directory that permits write access only to priviledged users.

Furthermore, I have tried to specify the new-filescreentemplate command without command arguments and receive the same error, so it looks like the "specified property is out of range" error has nothing to do with the command parameters itself :

PS C:\Users\Administrator> $notification2 = new-fsrmaction command -Command "C:\crypto.bat" -SecurityLevel LocalSystem -
RunLimitInterval 1
PS C:\Users\Administrator> new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification2
 -Active:$false
new-fsrmfilescreentemplate : 0x8004530d, The specified property is out of range.
At line:1 char:1
+ new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FsrmFileScreenTemplate:Root/Microsoft/...eScreenTemplate) [New-FsrmF
   ileScreenTemplate], CimException
    + FullyQualifiedErrorId : HRESULT 0x8004530d,New-FsrmFileScreenTemplate

Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 2:11pm

Hi,

From the result, it is the new-fsrmfilescreentemplate part which causes the issue.

Let's try to replace the new-fsrmaction part and see if it is related.

$notification3 = New-FsrmAction Event -EventType Information -Body "This is just for test." -RunLimitInterval 180

new-fsrmfilescreentemplate -name "CRYPTO" -includegroup "CRYPTO" -Notification $Notification3

Note: Make sure you do have the group CRYPTO created. 

July 28th, 2015 9:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics