weird logging behaviour

Welcome Forums General PowerShell Q&A weird logging behaviour

Viewing 3 reply threads
  • Author
    Posts
    • #248683
      Participant
      Topics: 41
      Replies: 94
      Points: 560
      Rank: Major Contributor

      hi all

      I make use of this logging function script write-log  and this is working like a charm.
      since the logging is part of an offboarding script I call several separate ps files to do different jobs.

      basically I start in a checks script and within this checks script I call offboarding AD for example

      in this offboarding AD I use the write-log message that says offboarding for $user.samaccountname in progress

      when I run it in this sequence I get as result in my logging

      VERBOSE: beginning with the offboarding process for @{SamAccountName=mactest; [email protected]; [email protected]}.samAccountname
      when I use the write-log function directly in the offboarding AD script I get as expected “beginning offboarding process for mactest”

      how can I get the same result as when I call the write-log function from the offboarding AD script.

      thanks for your assistance
      Paul

    • #248782
      Participant
      Topics: 25
      Replies: 184
      Points: 658
      Helping Hand
      Rank: Major Contributor

      try $($user.samaccountname)

      that will give you only the contents of the samaccountname vs the entire object

    • #248923
      Participant
      Topics: 41
      Replies: 94
      Points: 560
      Rank: Major Contributor

      Hi David I tried that as well but no such luck

    • #249001
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      Hi David I tried that as well but no such luck

      You should share the relvant code. Otherwise we have to guess and that’s usually a very bad idea. 😉

Viewing 3 reply threads
  • You must be logged in to reply to this topic.