Add IP address with the input

Drago,
Welcome to the forum. :wave:t4:

Please, when you post code or sample data or console output you should format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance

Instead of creating the file first and chaging it later I’d prefer using a here-string as template and input the received IP address before writing the file to the disk.

Something like this:

$IPAddress = Read-Host Prompt 'What is the IP address ?'
$TextTemplate = 
@"
"status": "success",
"response": {
"Ip address": "$($IPAddress)",
"@ 

New-Item -Path 'C:\test' -ItemType Directory 
$TextTemplate | 
    Out-File -FilePath 'C:\test\file1.txt'