none
Granfeldt Powershell MA Export not doing anything RRS feed

  • Question

  • I'm sure i'm doing something wrong that is a simple error.

    I have a powershell MA that connects to eDirectory, and successfully imports the user and group objects I want with the needed attributes.

    I am running into issues with the Export process.

    I am running the 5.5 management agent.

    I am just trying to do some simple tests to see how the export script handles the attributes, and am using simple objects. In my current export script I just have it attempt to dump the attributes passed to is in a text file to see what they are, but I've run into a roadblock.

    When I format the script as shown in all the examples I see, none of it runs. So the following will produce no text file:

    PARAM (
        $Username,
        $Password
    )
    
    BEGIN 
    {
    write-output "begin section" | Out-File c:\test.txt -Append
    }
    
    
    PROCESS 
    {
    write-output "process section" | Out-File c:\test.txt -Append
    }
    
    END 
    {
    write-output "end section" | Out-File c:\test.txt -Append
    }
    


    however if I comment out the begin, process, and end blocks, it will create the text file.

    PARAM (
        $Username,
        $Password
    )
    
    #BEGIN 
    #{
    write-output "begin section" | Out-File c:\test.txt -Append
    #}
    
    
    #PROCESS 
    #{
    write-output "process section" | Out-File c:\test.txt -Append
    #}
    
    #END 
    #{
    write-output "end section" | Out-File c:\test.txt -Append
    #}

    I of course in my first go-arounds with this had scripting in there to grab the needed attributes using the PSCustom object formatting, but since I can't seem to get past this part of the process, i figured i'd just share this?

    what am I missing?

    thanks for any suggestions!

    Wednesday, February 25, 2015 7:26 PM

Answers

  • interestingly enough a reboot of FIM solved my issue. First block of code in this thread worked fine.
    • Marked as answer by Nathan Lewan Tuesday, March 3, 2015 9:57 PM
    Tuesday, March 3, 2015 9:57 PM

All replies

  • looking at it a little closer, the begin, process, and end seem to be parts used on a function. I imagine the powershell management agent takes the export script and packages it in a function? Do I need to define this function myself? Like this?

    Func DoStuff {
      PARAM (
          $Username,
          $Password
      )
    
      BEGIN 
      {
      write-output "begin section" | Out-File c:\test.txt -Append
      }
    
    
      PROCESS 
      {
      write-output "process section" | Out-File c:\test.txt -Append
      }
    
      END 
      {
      write-output "end section" | Out-File c:\test.txt -Append
      }
    
    }
    
    DoStuff

    ?

    Thanks!

    Wednesday, February 25, 2015 11:48 PM
  • interestingly enough a reboot of FIM solved my issue. First block of code in this thread worked fine.
    • Marked as answer by Nathan Lewan Tuesday, March 3, 2015 9:57 PM
    Tuesday, March 3, 2015 9:57 PM