((Get-Content -Path '\\Windows7\c$\test.txt' -Raw) -replace ' username', ' white') | Set-Content -Path '\\Windows7\C$\test.txt'
Windows7 White
PCNT34 JDOck
FRANKIST Ballon
...
ASKER
ComputerName NewUserName
Windows7 White
W12 Brown
You cannot call a method on a null-valued expression.
At C:\Scripts\changestring.ps1:11 char:2
+ $computer = $_.ComputerName.Trim()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Scripts\changestring.ps1:12 char:2
+ $newUser = $_.NewUsername.Trim()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Processing , new user '' ... FAILED: Cannot find path '\\\C$\test.txt' because it does not exist.
You cannot call a method on a null-valued expression.
At C:\Scripts\changestring.ps1:11 char:2
+ $computer = $_.ComputerName.Trim()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Scripts\changestring.ps1:12 char:2
+ $newUser = $_.NewUsername.Trim()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Import-Csv -Path $csv -Delimiter "<Delimiter here>" | ForEach-Object {
ASKER
ComputerName,NewUserName
Windows7,White
W12,Brown
ASKER
A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.
TRUSTED BY
Just save it an Excel as file type "Csv".