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 (430 points)

1 Answer

0 votes
by (440 points)
selected by
Best answer

Hi,

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.

0

Hello,

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 (200 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 (1.2k points)
0 votes
1 answer

Having a strange issue, when executing a powershell command in adaxes as a business rule, the first line, no matter what is there comes up as invalid. Originally my ... line, but I've tried everything and universally the first line is flagged as invalid

asked Oct 23 by curtisa (290 points)
0 votes
0 answers

Trying to configure a custom launcher in Thycotic Secret Server that will launch Adaxes on the user's local machine with the username and password passed as parameters. Has anyone made this work?

asked May 20, 2022 by amillard (20 points)
0 votes
1 answer

This may sound a little convoluted, but I will try and explain. I'd like to have an operation require approval by a group. And if the initiator is a member of that group, I don ... into it at a new company. I've got to dust off some of the brain cells. Thanks.

asked Jul 17 by wd.swaters (40 points)
3,589 questions
3,277 answers
8,303 comments
548,105 users