none
Run Add-DHCPServerV4Failover remotely RRS feed

  • Question

  • Dear folks,

    I am trying to write a script which will go through all DHCP Servers in domain and configure DHCP failover on them if not already configured. 

    I have a schedule task that would run daily and do this. However, while running below, I get the error that permission is denied.

    Add-DhcpServerv4Failover -ComputerName $Server -PartnerServer $backupServer -Name $Server"-"$backupServer -ServerRole Active -ReservePercent 5 -MaxClientLeadTime 1:00:00 -StateSwitchInterval 00:15:00 -ScopeId $Scopes.ScopeId.IPAddressToString -SharedSecret "N0T$tr0ng" -Force -CimSession $cimsession
    -------------------------------------------------------------------------------------------------------------------------------

    Error : 

    Failed to verify if a failover relationship by the name abx-xyz exists on server xyz
        + CategoryInfo          : PermissionDenied: (abc-xyz:root/Microsoft/...erverv4Failover) 
    [Add-DhcpServerv4Failover], CimException
        + FullyQualifiedErrorId : WIN32 5,Add-DhcpServerv4Failover
        + PSComputerName        : abc
    Failed to verify if a failover relationship by the name abc-xyz
    exists on server xyz.
        + CategoryInfo          : PermissionDenied: (abc-xyz:root/Mi
       crosoft/...erverv4Failover) [Add-DhcpServerv4Failover], CimException
        + FullyQualifiedErrorId : WIN32 5,Add-DhcpServerv4Failover
    -----------------------------------------------------------------------------------------------------------------------------------

    If I launch powershell and run the same command without cimsession from the remote computer itself. It will run just fine.

    Can anyone help me understand this please and suggest a way forward?
    Sunday, October 25, 2020 7:29 AM

Answers

  •  take a look on doule hop problem description - look like it may be your case

    for solving that problem you can use 2 scripts:

    - 1 configuring schedulled task on a remote host to run your 2nd script

    - 2 configure dhcp locally (from scheduller)


    The opinion expressed by me is not an official position of Microsoft

    • Marked as answer by Gasah Friday, October 30, 2020 11:24 AM
    Sunday, October 25, 2020 8:35 AM

All replies

  •  take a look on doule hop problem description - look like it may be your case

    for solving that problem you can use 2 scripts:

    - 1 configuring schedulled task on a remote host to run your 2nd script

    - 2 configure dhcp locally (from scheduller)


    The opinion expressed by me is not an official position of Microsoft

    • Marked as answer by Gasah Friday, October 30, 2020 11:24 AM
    Sunday, October 25, 2020 8:35 AM
  • Thank you, yes it is double hop problem.
    Friday, October 30, 2020 11:25 AM