![]() NameEmailPhone save the html file in the current directory or send it with Send-MailMessage ![]() Padding: url(|Josefin+Sans|Orbitron:500|Yrsa) įont-family: 14px/1.4 'Indie Flower', 'Josefin Sans', Orbitron, sans-serif # next, create the html using a here-string # create and output a new table row with the properties for the user # '' -f ::ToBase64String($_.thumbnailPhoto), $_.DisplayName # that there is no need to store the images as publically accessable files. # the resulting HTML file will become quite large because of this, but the advantage is # encode the bytes of the image in a Base64 string and inline embed it in the page $_.thumbnailPhoto | Set-Content -Path $file -Encoding Byte -Force # save the image data to file in the current path and link that in the HTML # if there is a thumbnailPhoto for this user, create an tag, otherwise use a non breaking space $table = (Get-ADUser -Filter * -Properties DisplayName,EmailAddress,OfficePhone,Department,Title,thumbnailPhoto | # collect an array of html table rows and join together with a newline ![]() Then, the part to get the desired user properties is way too complicated (first you get ALL properties with -Properties * and later you execute Get-ADUser a second time, again having it return all properties to finally filter them out using a Select-Object). HTML has the tag for that, see here for instance. The main problem with your code is that you use Set-Content without a path and that you simply add the Byte data into a. $html+=" $($item.DisplayName) $($item.EmailAddress) $($item.OfficePhone) $($item.Department) $($item.Title) $($item.thumbnailPhoto) " $item.thumbnailPhoto | Set-Content -Encoding byte NameEmailPhone NumberDepartmentTitlePhoto ![]() $html= url(|Josefin+Sans|Orbitron:500|Yrsa) body $AllUsersFilter= $AllInfoProperties| Sort-Object Department,Enabled | Select DisplayName,EmailAddress,OfficePhone,Department,Title,thumbnailPhoto $AllInfoProperties+=Get-ADUser -Identity $IDName -Properties * | Select * $usersnames= get-aduser -filter * -Properties * Write-Verbose "Getting information from users" It goes through and if statement checking if the user has a photo or not. $item.thumbnailPhoto | Set-Content $PhotoPath -Encoding byte The code trying to encode it is the following section: I'm trying to have it display the image in a tag as the final product. However at the moment when its trying to display the photo its coming back in binary and not decoding it? I've tried to implement a decode section of my code displayed in bold but it doesn't work. I'm setting up a powershell script that looks to active directory and gets a users Name, Title and ThumbnailPhoto.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |