DnsServer Module cmdlets need a credential parameter
It would be extremely useful if the cmdlets in the DnsServer module had the credential parameter. It's a lot easier to provide the credentials in a variable versus having to wrap the cmdlet in a script block every time you want to run it with different credentials.
Thank you for your response. That's a great idea, but I get the same result from using a CimSession as I do when doing it in a PSSession. I always get permission denied. Are you supposed to create the CimSession or PSSession on an domain controller, or something else? I'd rather not enable psremoting on DCs unless we just have to... This is why I think it would be much easier to just have a credential parameter for these cmdlets versus having to run these cmdlets in sessions.
Get-DnsServer -ComputerName $ADServer -CimSession $CS
Get-DnsServer : Failed to get server information on [redacted] server.
Failed to retrieve DNS server configuration from [redacted] server.
At line:1 char:1
+ Get-DnsServer -ComputerName $ADServer -CimSession $CS
+ CategoryInfo : PermissionDenied: ([redacted]:root/Microsoft/Windows/DNS/PS_DnsServer) [Get-DnsServer], CimException
+ FullyQualifiedErrorId : WIN32 5,Get-DnsServer
This is already possible using these cool things called CimSessions.
# Get help on CIM sessions
PS C:\> Get-Help CimSession
# Create a new CIM session with alternate credentials
$cs = New-CimSession -Credential localhost\Administrator -ComputerName localhost
# Use a cmdlet from the DnsServer module using a CimSession
Get-DnsServer -CimSession $cs