Pull data from text file into PS Script.


i extreme novice @ ps scripting , wondering how pull data each line of txt (or csv) , plug script.  below current script , want able use each line txt file or csv in $client variable. there 300+ "client" names.

$client = "client1"
$environment = "-testenv"

$targetdns = "bigtime$environment"        
$newclient = "$client-testenv"

add-dnsrecord -session $session -hostheadername $newclient -targethost $targetdns

i believe have use like:

get-content c:\path\clientnames.txt | foreach...............

start learning use powershell "help"

type "help help" , read instructions.  after  on cmdlet , @ examples;


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2