Share via

Powershell script to assign StaticIP and then join to the domain

Nahum Eliash 46 Reputation points
2022-07-15T11:45:04.55+00:00

Hi guys,

I created an new Lab-test environment, and i have about 60 Windows2019 servers to jong to the domain.
although i googled the script i need, i've been trying to find similar.

i'll be very grateful.
all i need is that the script will change the IP address and then join the server to the domain, and restart...
Any suggestions?

I'll be very grateful,
Best regards.

Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
0 comments No comments

1 answer

Sort by: Most helpful
  1. Rafael da Rocha 5,251 Reputation points
    2022-07-15T13:43:30.493+00:00

    Without your current code, it's not clear how you're trying to achieve this.

    But on a high level I believe the easy way to do it would be to have the server name and desired static IP in a CSV. Iterate over the names, run Set-NetIPAddress, Set-DNSClientServerAdress and Add-Computer on the remote host.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.