Granfeldt Powershell MA Export not doing anything

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!

February 25th, 2015 2:28pm

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!

Free Windows Admin Tool Kit Click here and download it now
February 25th, 2015 6:50pm

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 03, 2015 9:57 PM
March 3rd, 2015 9:57pm

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 03, 2015 9:57 PM
Free Windows Admin Tool Kit Click here and download it now
March 3rd, 2015 9:57pm

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

Other recent topics Other recent topics