Difference between revisions of "Useful PowerShell Commands"
Jump to navigation
Jump to search
Line 22: | Line 22: | ||
import-csv ./rename.csv | rename-item | import-csv ./rename.csv | rename-item | ||
<p>The CSV File</p> | <p>The CSV File</p> | ||
< | <pre> | ||
Path,NewName | Path,NewName | ||
dog.jpg,222-dog.jpg | dog.jpg,222-dog.jpg | ||
rat.jpg,333-rat.jpg | rat.jpg,333-rat.jpg | ||
cat.jpg,111-cat.jpg | cat.jpg,111-cat.jpg | ||
</ | </pre> | ||
==[[Main_Page| Home]] - [[PowerShell|Category]]== | ==[[Main_Page| Home]] - [[PowerShell|Category]]== |
Revision as of 17:08, 18 October 2024
Get-ComputerInfo
Accessing the properties of a command
Get-Computerinfo -Properties csusername Get-Computerinfo -Properties csusername | Get-Member Get-ComputerInfo | Format-List OsType,osName,csusername
Write output to the screen, like Echo
Write-Output "Hello World"
Read Text file
Get-Content filename.txt
Rename-Computer Restart-Computer Get-Date Get-TimeZone
Update Windows From PowerShell
Import csv file The pipe it to another function
import-csv .\filename.csv |
Rename Files using csv list
If you execute the script in the same directory as the files, you don't have to add the full path, but if it's in a different directory the the full path is needed
import-csv ./rename.csv | rename-item
The CSV File
Path,NewName dog.jpg,222-dog.jpg rat.jpg,333-rat.jpg cat.jpg,111-cat.jpg