Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Export GPO with Illegal Characters

$
0
0

Hi good folks,

I’m trying to export a large number of GPO’s to htm for archiving purposes using the following command but unfortunately it doesn’t work for the majority of GPO’s because of the formatting used includes an illegal character for the exported file name.

Get-GPO -All | % {$.GenerateReport(‘html’) | Out-File “$($.DisplayName).htm”}

An example of a GPO would be where this | appears to be the illegal character causing the problem.

| SYSTEM | Server Manager – Do not Display

I’m not great at script formatting or indeed know if/how it would be possible but can the PS script be written to exclude the illegal character and export anyway?

I know I can export all of the GPO’s into one large .htm file or any given name but it would be extremely useful to have individual .htm files for each GPO with the naming convention (-minus the illegalcharacter) for reference purposes in the future.

Thanks in advance.

submitted by /u/grimgriefer
[link] [comments]

The post Export GPO with Illegal Characters appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles