Preparations
Configuring a PowerShell Execution Policy
Check the execution policy and ensure that PowerShell allows script execution. Open PowerShell and run the following command to check the current execution policy:
Get-ExecutionPolicy
The PowerShell execution policies are as follows:
- Restricted: No script can be executed.
- AllSigned: Only scripts signed by trusted publishers can be run.
- RemoteSigned: Locally created scripts can be run without signatures, but remotely downloaded scripts must be signed.
- Unrestricted: All scripts can be executed, but a warning is generated when a script downloaded from the Internet is executed.
- Bypass: Nothing is blocked and there are no warnings or prompts.
If the execution policy is Restricted or AllSigned, run the following command to temporarily change the policy to allow the execution of locally created scripts and signed remote scripts:
Set-ExecutionPolicy RemoteSigned -Scope Process
This command changes the execution policy only in the current PowerShell session and restores the default policy after the session ends.
Preparing a CSV File
username,ip,port,password
- username: indicates the username for logging in to the source server. To ensure that the script has sufficient permissions to perform the modification, you need to run it as a user with administrator permissions, such as Administrator.
- ip: indicates the private IP address of the source server.
- port: listening port of the WinRM service. The default port is 5985.
- password: indicates the password for logging in to the source server. The scripts use this password to automatically connect to the source server through WinRM.
- The first row in the CSV file is the header row.
- Each line in the CSV file contains the information for a single server, with each piece of information separated by a comma.
- Ensure the format is correct and the information is accurate, avoiding any extra spaces, commas, or invalid IP addresses.
username,ip,port,password Administrator,192.168.1.10,xx,examplePass123 Administrator,192.168.1.11,xx,examplePass456
Preparing the Hosts File
Create a text file that contains the content to be added to the hosts file on the source servers. Ensure that the file can be accessed. Write the API domain names mappings for the related cloud services into the file, and start with #Migration-proxy-start and end with #Migration-proxy-end. The API domain name mappings of related cloud services depend on the actual environment. Contact the environment contact person of the corresponding site to obtain the mappings.
#Migration-proxy-start xxx.xxx.xxx.xxx iam.xxx.com xxx.xxx.xxx.xxx ecs.xxx.com xxx.xxx.xxx.xxx evs.xxx.com xxx.xxx.xxx.xxx ims.xxx.com xxx.xxx.xxx.xxx obs.xxx.com xxx.xxx.xxx.xxx eps.xxx.com xxx.xxx.xxx.xxx vpc.xxx.com #Migration-proxy-end
Preparing a Log Directory
- Configure the log directory. The scripts use C:\Users\Public\Hosts_Script_Logs as the default log storage directory. If the directory cannot be found, the scripts automatically create it. To change the log storage directory, change the value of $logDir in the script.
- Check the permissions for the log directory. Ensure that the current user has the write permission for the log directory. If the permissions are insufficient, modify the directory permissions or use another directory.
Checking the Network Connectivity
- Check the network connection. Ensure that the server where the scripts are executed can access the IP addresses and ports of all Windows source servers over the network. The script executor must be able to access all Windows source servers over port 5985.
- Configure the firewalls. Check and configure the firewalls on the local computer and source servers to ensure that remote PowerShell sessions can be established through WinRM.
- Enable the WinRM service. Ensure that the WinRM service has been enabled and is running properly on all Windows source servers. You can run the following command on the source servers to enable WinRM:
Enable-PSRemoting -Force
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot