We have a script the send an HTML email to HR with new user information upon creation is there a way to take that HTML email and create a word document that saves to a folder as well? I can provide the script if needed.

by (1.3k points)
by (306k points)
0

Hello,

Yes, it is possible. However, there are a lot of known issues when working with Microsoft Office Word from PowerShell and for some of them there are no fixes/workarounds. That is why, we recommend you to save the notification text to a CSV file. Please, specify the solution you prefer and post here or send us (support[at]adaxes.com) the script you currently have.

If there is anything else except for saving the details to a file that you need added to the script, please, provide us with details.

by (1.3k points)
0

We are using the following code to copy new user info into a txt file and it was working great until we change our Direct and Fax number formatting from 1234567890 to (123) 456-7890. Is there a way to still use something like this and keep the new number formatting?

#File Path 
$filePath = “New User Sheets\%physicalDeliveryOfficeName%\New User Info - %firstname% %lastname%.txt"

#Tie Properties to Variables
$DID = %telephoneNumber%
$Fax = %facsimileTelephoneNumber%
$Copitrak = %pager%
$Extension = %ipPhone%

# Format Fax, DID and Copitrak Fields
If ($DID -eq "" ) {$DID2= "N/A"} Else {$DID2 = $DID}
If ($Fax -eq "") {$Fax2= "N/A"} Else {$Fax2 = $Fax}
If ($Copitrak -eq "") {$Copitrak2= "N/A"} Else {$Copitrak2 = $Copitrak}
If ($Extension -eq "") {$Extension2= "N/A"} Else {$Extension2 = $Extension}

#Write Output
Write "User Information" | Out-File -FilePath $filePath
Write "Full Name: %name%" | Out-File -FilePath $filePath -Append
Write "Username: %username%" | Out-File -FilePath $filePath -Append
Write "Password: %unicodePwd%" | Out-File -FilePath $filePath -Append
Write "Email: %mail%" | Out-File -FilePath $filePath -Append
Write "Job Title: %title%" | Out-File -FilePath $filePath -Append
Write "" | Out-File -FilePath $filePath -Append
Write "Phone Information" | Out-File -FilePath $filePath -Append
Write "Extension: $Extension2" | Out-File -FilePath $filePath -Append
Write "Direct Dial Number: $DID2" | Out-File -FilePath $filePath -Append
Write "Fax Number: $Fax2" | Out-File -FilePath $filePath -Append
Write "Copitrak Code: $Copitrak2" | Out-File -FilePath $filePath -Append
Write "" | Out-File -FilePath $filePath -Append
Write "The user was added to the following groups:" | Out-File -FilePath $filePath -Append

# Get Group Memberships
$groupGuids = $Context.TargetObject.GetEx("adm-DirectMemberOfGuid")

foreach ($groupGuidBytes in $groupGuids)
{
    # Bind to the group
    $groupGuid = New-Object "System.Guid" (,$groupGuidBytes)
    $groupGuid = $groupGuid.ToString("B")
    $groupPath = "Adaxes://<GUID=$groupGuid>"
    $group = $Context.BindToObject($groupPath)

    # Write Group Output
    Write $group.Get("name") | Out-File -FilePath $filePath -Append
}

1 Answer

by (306k points)
Best answer
0 votes

Hello,

Yes, it is possible. You will just need to place the value references used to specify values of variables into quotes. We updated the script for you, find it below.

#File Path 
$filePath = "New User Sheets\%physicalDeliveryOfficeName%\New User Info - %firstname% %lastname%.txt"

#Tie Properties to Variables
$DID = "%telephoneNumber%"
$Fax = "%facsimileTelephoneNumber%"
$Copitrak = "%pager%"
$Extension = "%ipPhone%"

# Format Fax, DID and Copitrak Fields
If ($DID -eq "" ) {$DID2= "N/A"} Else {$DID2 = $DID}
If ($Fax -eq "") {$Fax2= "N/A"} Else {$Fax2 = $Fax}
If ($Copitrak -eq "") {$Copitrak2= "N/A"} Else {$Copitrak2 = $Copitrak}
If ($Extension -eq "") {$Extension2= "N/A"} Else {$Extension2 = $Extension}

#Write Output
Write "User Information" | Out-File -FilePath $filePath
Write "Full Name: %name%" | Out-File -FilePath $filePath -Append
Write "Username: %username%" | Out-File -FilePath $filePath -Append
Write "Password: %unicodePwd%" | Out-File -FilePath $filePath -Append
Write "Email: %mail%" | Out-File -FilePath $filePath -Append
Write "Job Title: %title%" | Out-File -FilePath $filePath -Append
Write "" | Out-File -FilePath $filePath -Append
Write "Phone Information" | Out-File -FilePath $filePath -Append
Write "Extension: $Extension2" | Out-File -FilePath $filePath -Append
Write "Direct Dial Number: $DID2" | Out-File -FilePath $filePath -Append
Write "Fax Number: $Fax2" | Out-File -FilePath $filePath -Append
Write "Copitrak Code: $Copitrak2" | Out-File -FilePath $filePath -Append
Write "" | Out-File -FilePath $filePath -Append
Write "The user was added to the following groups:" | Out-File -FilePath $filePath -Append

# Get Group Memberships
$groupGuids = $Context.TargetObject.GetEx("adm-DirectMemberOfGuid")

foreach ($groupGuidBytes in $groupGuids)
{
    # Bind to the group
    $groupGuid = New-Object "System.Guid" (,$groupGuidBytes)
    $groupGuid = $groupGuid.ToString("B")
    $groupPath = "Adaxes://<GUID=$groupGuid>"
    $group = $Context.BindToObject($groupPath)

    # Write Group Output
    Write $group.Get("name") | Out-File -FilePath $filePath -Append
}

Related questions

Hi, is it possible to save to an Adaxes attribute the value of the last Sign In from Azure AD? When we query users for Last Logon, we, of course, can only see the Last Logon value from AD It would be very useful to know the latest login in Azure AD as well

asked Jun 22, 2020 by manuel.galli (100 points)
0 votes
1 answer

Hi, I want to create specific Tier accounts for selected users. Therefor I created a copy action and want to predefine same values However the values of these fields are using the ... or a bug? How can I use the value references of the selected user object?

asked Sep 4 by wintec01 (2.3k points)
0 votes
1 answer

Hello, The report named Inactive users allowed to log in shows the Active Directory sign-in (Last-Logon-Timestamp) and Azure AD sign-in (Last Logon) but only for Active Directory ... updated by an Azure logic App. But we'd love to have this natively in Adaxes.

asked Dec 13, 2022 by Gavin.Raymen (40 points)
0 votes
1 answer

I have problem to connect mysql to adaxes, what adaxes is support mysql or not suport mysql. can you give a sample script to connect adaxes to mysql?

asked Jan 5, 2022 by systech (100 points)
0 votes
1 answer

Hi , I would like to know that is there any API service, where we can work on objects inside Adaxes tool? Preferbly REST API?

asked Nov 6, 2019 by Anil (20 points)
0 votes
1 answer