Bug description
There are cases where if you provide a file name (output.svg) and format (.png) the output file is in png format, but has the svg extension.
It is necessary to validate the format and extension to make sure they are correct. If not, the script should terminate (throw)....
Command-line input
new-addiagram -Target server-dc-01v.pharmax.local -Credential $Cred -Format png -DiagramType Sites -Direction top-to-bottom -OutputFolderPath C:\Users\jocolon -Filename outputpng.svg -Rotate 180
Steps to reproduce
- run the script with the $format set to svg and the filename set to output.png
- the image is create but the extension are wrong
Expected behaviour
Validates whether the $Format and file extension match
Screenshots
No response
Operating System
Windows 10
PowerShell Version
Name Value
---- -----
PSVersion 5.1.19041.3803
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3803
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PowerShell Modules
Name Version
---- -------
Diagrammer.Microsoft.AD 0.2.1
PSGraph 2.1.38.27
Additional Context
PS C:\Users\jocolon> new-addiagram -Target server-dc-01v.pharmax.local -Credential $Cred -Format png -DiagramType Sites -Direction top-to-bottom -OutputFolderPath C:\Users\jocolon -Filename outputpng.svg -Rotate 180
Please wait while the Microsoft.AD diagram is being generated.
PS C:\Users\jocolon>
Microsoft.AD diagram 'outputpng.svg' has been saved to 'C:\Users\jocolon'
PS C:\Users\jocolon>
Before submitting