The help for Export-DnsServerZone says:
-FileName <String>
Specifies a name for the export file. You can include a file path.
Did you try it?
Otherwise, just install rsat-adds and rsat-dns-server on your “script host” to get all the required commands.
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BjSP2ky9nYCjBmYor6CTdGn9AYFsiC6c_CPF79maV5APA%40mail.gmail.com.
The help for Export-DnsServerZone says:
-FileName <String>
Specifies a name for the export file. You can include a file path.
Did you try it?
Otherwise, just install rsat-adds and rsat-dns-server on your “script host” to get all the required commands.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/f8aea9c601d840188cba826432114b25%40smithcons.com.
Those fun facts would’ve been good to include in your original email.
You’re right. It’s broken. I’ve verified in my test environment.
First, I’d file a bug report.
Second, I’d use invoke-command with the secrets management module.
There are several problems with that cmdlet. The one you found of course, and it doesn’t have any controls for overwriting the existing file (or not).
You might consider using dnscmd.exe /zoneexport instead.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BiDPzNAfngNNOXcBO-chazdK%3Dvv0ewwemmnGdRbQ1os%3Dw%40mail.gmail.com.
Those fun facts would’ve been good to include in your original email.
You’re right. It’s broken. I’ve verified in my test environment.
First, I’d file a bug report.
Second, I’d use invoke-command with the secrets management module.
There are several problems with that cmdlet. The one you found of course, and it doesn’t have any controls for overwriting the existing file (or not).
You might consider using dnscmd.exe /zoneexport instead.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/e97920041c444011be7cb1bc6a47f38f%40smithcons.com.
If you run it remotely using invoke-command, can copy the output file locally.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bj3%2BHWa4JFjUYkX9Ea8yOo7z1inPYJkhB22mSekGPDGag%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/b22839b329be4af1a4a5c2e7236ce596%40smithcons.com.
I think reverse zones are important. That’s kind of a personal choice. 😊
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bimo4Or7EEAG5U0t%3DQ-CN6YJd0B4p7XP95k_8DsPA_bXQ%40mail.gmail.com.
I think reverse zones are important. That’s kind of a personal choice. 😊
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/ee86c2b9c4714c7eb4509af419528f49%40smithcons.com.
I think reverse zones are important. That’s kind of a personal choice. 😊
If you run it remotely using invoke-command, can copy the output file locally.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/b22839b329be4af1a4a5c2e7236ce596%40smithcons.com.
Change
Write-Verbose "ERROR!! Exporting $Zone."
To
Write-Verbose "ERROR!! Exporting $Zone, error $( $error[ 0 ] )."
In order to get the actual error.
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Mike Leone
Sent: Friday, October 31, 2025 2:59 PM
To: ntpowe...@googlegroups.com
Subject: Re: [ntpowershell] Script to backup DNS zones
On Fri, Oct 31, 2025 at 1:09 PM Michael B. Smith <mic...@smithcons.com> wrote:
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bgr1WNRSw8aqNPGbZsH6E1JvFmpYOQqj3iuqgP4E9oDVQ%40mail.gmail.com.
Try specifying the credentials for invoke-command, and -RunAs if available.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BghAXDETJQkW2eNN8XBxHtjNLBbXjNETJYVBCdk93vXGQ%40mail.gmail.com.
Try specifying the credentials for invoke-command, and -RunAs if available.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/4cb753aff99745fcbe05ed17a4efdae3%40smithcons.com.
You made me go look. It’s called RunAsAdministrator.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bgj2LsQv5xts4q-NqtyLpTOv94L8MCRfe2Fqa2fMXan0g%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/7fa7c0e761b24005be3e2574bbf10a27%40smithcons.com.
Export, then move (or rather robocopy) is all I do in my script.
FWIW, I also include all the zones. The exports are just text files so you can remove portions of it after the fact if you decide you don’t want them restored.
--
John Wright
IT Support Specialist
![]()
1800 Old Bluegrass Avenue, Louisville, KY 40215
Please submit IT requests to Hazelwoo...@bluegrass.org
24 Hour Helpline 1.800.928.8000
CONFIDENTIALITY NOTICE: This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Mike Leone
Sent: Friday, October 31, 2025 12:32 PM
To: ntpowe...@googlegroups.com
Subject: Re: [ntpowershell] Script to backup DNS zones
|
EXTERNAL EMAIL - This email was sent by a person from outside your organization. Exercise caution when clicking links, opening attachments or taking further action, before validating its authenticity. |
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bimo4Or7EEAG5U0t%3DQ-CN6YJd0B4p7XP95k_8DsPA_bXQ%40mail.gmail.com.
Export, then move (or rather robocopy) is all I do in my script.
FWIW, I also include all the zones. The exports are just text files so you can remove portions of it after the fact if you decide you don’t want them restored.
No, my runs as a scheduled task without a problem. But I’ll look over this thread more later and see if I can figure out what’s going on.
--
John Wright
IT Support Specialist
![]()
1800 Old Bluegrass Avenue, Louisville, KY 40215
Please submit IT requests to Hazelwoo...@bluegrass.org
24 Hour Helpline 1.800.928.8000
CONFIDENTIALITY NOTICE: This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Mike Leone
Sent: Monday, November 3, 2025 9:39 AM
To: ntpowe...@googlegroups.com
Subject: Re: [ntpowershell] Script to backup DNS zones
|
EXTERNAL EMAIL - This email was sent by a person from outside your organization. Exercise caution when clicking links, opening attachments or taking further action, before validating its authenticity. |
On Mon, Nov 3, 2025 at 9:31 AM Wright, John M <John....@newvista.org> wrote:
Export, then move (or rather robocopy) is all I do in my script.
That's what I'm doing. Export zones with the Powershell command, then (for good measure) expor with DNSCMD, and I then move (using the Powershell move-item) all those files to a network share, in a sub-folder with the run date.
FWIW, I also include all the zones. The exports are just text files so you can remove portions of it after the fact if you decide you don’t want them restored.
My problem is, it isn't running correctly if I execute it remotely. It does execute correctly if I execute it locally on the DC (using the same AD account). So in order to run it as a scheduled task on the DC, I need to grant the account "log on as a batch" access right, and I don't seem to see that on the local gpedit. I can change the domain DC policy and add the account, I guess.
Is that how you do it? Or do you not have these issues as a scheduled task?
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BiSeDrpxz6_8ayocv%3DnBgThYQDWMwqUge0TBqZkM6g%3DNA%40mail.gmail.com.