Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Start-Transcript -Path C:\_lab2_transcript.txt -NoClobber
- #Outputting a command "Get-ChildItem" to a file "MyWinLogFile.txt"
- # -Filter *.log - file selection filter
- Get-ChildItem -Path C:\Windows\ -Filter *.log | Out-File D:\MyWinLogFile.txt
- #Displaying the contents of a file
- Get-Content D:\MyWinLogFile.txt
- #Adding results to a file "MyWinLogFile.txt"
- Get-ChildItem -Path C:\Windows\System32 -Filter *.dll | Out-File D:\MyWinLogFile.txt -Append
- #Displaying the contents of a file
- Get-Content D:\MyWinLogFile.txt
- #Renaming a file MyWinLogFile.txt to MyWinLogDLLFile.txt
- Rename-Item -Path D:\MyWinLogFile.txt -NewName MyWinLogDLLFile.txt
- #Create directory Lab2Output
- New-Item -Path C:\Lab2Output -ItemType "directory"
- #Copyng file D:\MyWinLogDLLFile.txt to directory C:\Lab2Output
- Copy-Item "D:\MyWinLogDLLFile.txt" -Destination "C:\Lab2Output"
- #Deleting file D:\MyWinLogDLLFile.txt
- Remove-Item "D:\MyWinLogDLLFile.txt"
- #Write a list of active processes to a file
- # -Append - adding new information to a file
- Get-Process | Out-File C:\Lab2Output\MyWinLogDLLFile.txt -Append
- #Renaming a file MyWinLogDLLFile.txt to MyWinLogDLLProcsFile.txt
- Rename-Item -Path C:\Lab2Output\MyWinLogDLLFile.txt -NewName MyWinLogDLLProcsFile.txt
- #Displaying the contents of a file MyWinLogDLLProcsFile.txt
- Get-Content C:\Lab2Output\MyWinLogDLLProcsFile.txt | more
- Stop-Transcript
- #END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement