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
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

Hi Is it possible to create an Azure OU programatically using the Adaxes PowerShell module? Thanks Matt

asked Sep 22, 2023 by chappers77 (2.0k points)
0 votes
1 answer

So I need to export a list of all user's Line URI's to a CSV file. Running Adaxes 2021 Version 3.14.18804.0 (64 bit) and Teams Powershell 4.1.0 ... a Microsoft 365 account } finally { # Close the connection and release resources Disconnect-MicrosoftTeams }

asked Aug 4, 2022 by TheLexicon (200 points)
3,346 questions
3,047 answers
7,772 comments
544,973 users