0 votes

I thought I would share this. We are new to Adaxes but really finding it a great tool to host some powershell scripts and make them accessible to others in the team without powershell knowledge.

This is a simple example command that outputs the DNS entries for a round-robin style dns we have for our small terminal server farm.

I just surround any command with '$logmessage =' in the front and the '| Out-String -Stream' at the end and then use the foreach loop to output it.

The '| Out-String -Stream' creates an array of strings from a formatted powershell output table. The second line then just loops through the array and outputs each line.

$logmessage = Get-DnsServerResourceRecord -ComputerName "dns-server-name" -Name "dns-entry-name" -ZoneName "domain-name" -RRType "A" | Out-String -Stream
foreach ($logline in $logmessage) { if ($logline -ne '') { $Context.LogMessage($logline, "Information") } }

If there are better ways to do this I am definitely interested.

by (1.7k points)

1 Answer

0 votes
by (850 points)
selected by
Best answer


I did the exact same thing in custom commands, you can query anything that works with PowerShell.

I write you an answer just because I'm also interested if there is another way.

I know that the previous Adaxes manager in my company did complexe CSV export and send them by email to the initiator. I don't think that is a good option, I prefer the .logmessage.

I took his code, remove the export-csv and send-mailmessage part and replace by this:

foreach($entry in $report){
$entryUser = $entry | select -ExpandProperty utilisateur
$entryAlias = $entry | select -ExpandProperty nom
$Context.LogMessage("$entryUser`,$entryAlias", "Information")

And it works well.



There is no other possibility to add multiple lines to the Execution log. You just need to call the $Context.LogMessage for each line separately. Putting the method into foreach is the best solution which should work just fine.

Related questions

0 votes
1 answer

When a user is editing their information on the self service website, I need them to enter data into the extentionAttribute2 field. This needs to be a multi-line field so the ... as a single line text field. Is this possible to do in Adaxes? Thanks in advance

asked Sep 24, 2014 by dannyd (970 points)
0 votes
1 answer

I've adapted a RegEx to normalize phone numbers, source: http://www.regexplanet.com/cookbook/pho ... index.html. Import-Module Adaxes $identity = "%sAMAccountName%" $mobileNumber = ' ... 555-5555, adaxes returned +1+1 (888) 555-5555. Any guidance on this?

asked Dec 20, 2014 by polley (4.7k points)
0 votes
1 answer

Hi I need to update some property patterns on a scheduled basis and am doing this via a powershell script. The particular attibute will be a drop down, but ... t work! $item.SetConstraints($constraints) $item.SetInfo() $userPattern.Items.Add($item) Thanks Matt

asked Nov 11 by chappers77 (4.5k points)
0 votes
1 answer

I have a powershell scrip that runs as a Action on a custom command, and this scrip calls the ExecuteCustomCommand PS Function on a user. Is there ... .ExecuteCustomCommand($command.CommandID, $commandArguments) And have the result contain the log messages.

asked Jun 17 by Justinc (290 points)
0 votes
1 answer

Hi, I need to start Adaxes scheduled task from Powershell console running on another host. How can I do that?

asked May 21 by KIT (3.1k points)
2,352 questions
2,106 answers
126,851 users