none
Add extension in FSRM File Group - Powershell RRS feed

  • Question

  • Hello Guys

    i have a environemnt with Win2K8 and W2K12 environement where i have FSRM installed on all of the machine and we weekly update file ext on the file groups.

    We are doing this manually so this is really a pain and feels like we are still living a world with out powershell.

    I have used the FSRM Powershell module to develop script by which i am able to add file ext on all W2K12 server as Server 2012 has this module inbuilt but not working on W2K8 as thier PS does not recognise FSRM cmdlets.

    I am using invoke-commnd to run it on remote server, please help me if there is any other way to run command on remote machine.

    Here is script which i have developed

    Function Add-FSRMFileGroupExt {

    [cmdletbingind()]

    param(

          [Parameter( 
            ValueFromPipeline=$true,
            ValueFromPipelineByPropertyName=$true)]
          [string[]]$ServerName,
          [string[]]$FileType
          )

    begin {}

    process {


    Invoke-Command -ComputerName $ServerName -ScriptBlock `
    {$Group=Get-FsrmFileGroup -Name "Temporary Files"
    $Listext=$Group.IncludePattern + "*.Tempora","*.testtemp"
    Set-FsrmFileGroup -Name "Temporary Files" -IncludePattern $Listext}

                                     }#Process Closing
                                     }#Function Closing
                                  
                                     

    Wednesday, August 10, 2016 8:52 PM

Answers

All replies

  • You are not correctly remoting and that will cause some issues:

    $cim = New-CimSession -ComputerName $server
    $Group = Get-FsrmFileGroup -Name "Temporary Files" -CimSession $cim
    $Listext = $Group.IncludePattern += @('*.Tempora', '*.testtemp')
    Set-FsrmFileGroup -Name "Temporary Files" -IncludePattern $Listext -CimSesion $cim


    \_(ツ)_/


    • Edited by jrv Wednesday, August 10, 2016 9:23 PM
    Wednesday, August 10, 2016 9:22 PM
  • There are no management classes for WS2008R2 and earlier.

    \_(ツ)_/


    • Edited by jrv Friday, November 11, 2016 5:27 PM
    Wednesday, August 10, 2016 9:41 PM
  • Hi Jrv,

    I am getting below error message with CIM

    Add-FSRMFileGroupExt -ServerName "xxxx"
    Set-FsrmFileGroup : A parameter cannot be found that matches parameter name 'CimSesion'.
    At C:\Users\devcheadm\Desktop\Add-FSRMFileGroupExt.ps1:21 char:68
    + Set-FsrmFileGroup -Name "Temporary Files" -IncludePattern $Listext -CimSesion $c ...
    +                                                                    ~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Set-FsrmFileGroup], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Set-FsrmFileGroup

    $cim = New-CimSession -ComputerName $server

    Is able to execute but not able to link to the -cimsession parameter

    $cim

    Id           : 4
    Name         : CimSession4
    InstanceId   : 71081139-df08-42f4-b4d6-dd9c5d19ac34
    ComputerName :xxxxx
    Protocol     : WSMAN





    Thursday, August 11, 2016 3:08 PM
  • Review the following:

    https://technet.microsoft.com/en-us/library/jj900615(v=wps.620).aspx

    You can also use:

    $Group = Get-FsrmFileGroup -Name "Temporary Files" -CimSession <remote server name>
    $Listext = $Group.IncludePattern += @('*.Tempora', '*.testtemp')
    $group | Set-FsrmFileGroup -IncludePattern $Listext


    \_(ツ)_/


    • Edited by jrv Thursday, August 11, 2016 3:34 PM
    Thursday, August 11, 2016 3:32 PM
  • Thanks Jrv, i am getting below error message.

    i have checked namespaces in wmi explorer and there is nothing like "root/microsoft/windows/fsrm".


    Get-FsrmFileGroup : The WS-Management service cannot process the request. The CIM namespace root/microsoft/windows/fsrm is invalid. 
    At line:1 char:1
    + Get-FsrmFileGroup -Name "Temporary Files" -CimSession "XXXXX"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (MSFT_FSRMFileGroup:Root/Microsoft/...T_FSRMFileGroup) [Get-FsrmFileGroup], CimExcepti 
       on
        + FullyQualifiedErrorId : HRESULT 0x80338000,Get-FsrmFileGroup
        + PSComputerName        : XXXXXX

    Thursday, August 11, 2016 4:01 PM
  • This only works on Windows 2012 and later.

    https://technet.microsoft.com/en-us/library/jj900608(v=wps.630).aspx


    \_(ツ)_/

    • Marked as answer by Chetan.Cosmos Thursday, August 11, 2016 8:22 PM
    Thursday, August 11, 2016 4:15 PM
  • Thanks Jrv...

    I have added the ext on all servers by using Filescrn command. 

    https://technet.microsoft.com/en-us/library/cc788082(v=ws.10).aspx 



    • Marked as answer by Chetan.Cosmos Monday, October 17, 2016 2:00 PM
    Thursday, August 11, 2016 8:22 PM
  • Thanks Jrv...

    I have added the ext on all servers by using Filescrn command. 

    https://technet.microsoft.com/en-us/library/cc788082(v=ws.10).aspx 



    Hi Chetan Cosmos

    Could you send me the Code with filescrn?

    I wrote this one but it does not work.

    $Group="filescrn filegroup Modify /filegroup:Test /Members:"
    $Listext=$Group.IncludePattern + "*.test"
    "filescrn filegroup Modify /filegroup:Test -IncludePattern $Listext"

    I would be very happy when you can help.

    Thank you

    Best regards

    Friday, November 11, 2016 5:22 PM
  • Hi Chetan Cosmos

    Could you send me the Code with filescrn?

    I wrote this one but it does not work.

    $Group="filescrn filegroup Modify /filegroup:Test /Members:"
    $Listext=$Group.IncludePattern + "*.test"
    "filescrn filegroup Modify /filegroup:Test -IncludePattern $Listext"

    I would be very happy when you can help.

    Thank you

    Best regards

    Wednesday, November 16, 2016 9:07 AM

  • sorry for late response, here is the script worked for me

    $servers= Get-content c:\servers.txt (server.txt is the file contain server hostname)  

    filescrn filegroup modify /filegroup:Test /Remote:$_ /members:"*.0x0|*.1999|*.Ct.zip|*.bleep|*.brolo.C|*.ccc|*.crinf|*.crjoker|*.Ping”


    • Edited by Chetan.Cosmos Monday, November 28, 2016 7:05 AM spell
    • Marked as answer by Chetan.Cosmos Tuesday, June 20, 2017 11:47 AM
    Monday, November 28, 2016 7:05 AM
  • I have tried but is am getting the error message

    $Group = Get-FsrmFileGroup -Name "Executable Files"
    $list = $Group.IncludePattern + "*.action,*.apk,*.app,*.bat,*.bin,*.cmd,*.com,*.command,*.cpl,*.csh,*.exe,*.gadget,*.zl9"
    $group | Set-FsrmFileGroup -IncludePattern $list

    error message

    Set-FsrmFileGroup : 0x80070057, The parameter is incorrect.
    At line:3 char:10
    + $group | Set-FsrmFileGroup -IncludePattern $list
    +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_FSRMFileGr...cutable Files"):Root/Microsoft/...T_FSRMFileGroup) [Set-FsrmFileGro 
       up], CimException
        + FullyQualifiedErrorId : MI RESULT 4,Set-FsrmFileGroup

    Monday, June 19, 2017 6:05 PM
  • This thread has been closed for almost a year.  Please open your own thread.

    Start with:

    help Set-FsrmFileGroup  -full


    \_(ツ)_/


    • Edited by jrv Monday, June 19, 2017 6:27 PM
    Monday, June 19, 2017 6:26 PM