Lower process priority
Lowering process priority
Http://app.en25.com/e/es.aspx? S = 1403 & E = 7006 & elq = d22c2238899d4fc7a2952a7e42ab8c81
The following command reduces the priority of notepad processes in the current process to belownormal. The default process priority is normal.
Get-process notepad | foreach-object {$ _. priorityclass = "belownormal "}
Add a new event log Source
&
Write logs
Adding new event log sources
&
Writing your own event log entries
Http://app.en25.com/e/es.aspx? S = 1403 & E = 7042 & elq = f238ef0ee41f4a8cb5ecbd049488bfd1
&
Http://app.en25.com/e/es.aspx? S = 1403 & E = 7110 & elq = dd228c9d63244a3a99a5d9b652ec047f
If you want to use Event Logs, you must first register one. Make sure that the account to be executed has administrator privileges.
New-Eventlog application powershellscripts
After registration, you can use the following methods to write logs:
Write-Eventlog-LOGNAME application-source powershellscripts-entrytype warning-eventid 12345-message 'This is my message'
Logs are written in the operating system.
View the folder directory on your desktop
Finding a user's desktop folder
Http://app.en25.com/e/es.aspx? S = 1403 & E = 7183 & elq = bd457dddf07d405abb3b8936a1d71895
It is mainly obtained through the Environment class in. Net:
[Environment]: getfolderpath ("desktop ")
In addition, you can use the following command to obtain all available directories:
[Enum]: getnames ([system. Environment + specialfolder])
Operation Method under path
Working with path names
Http://app.en25.com/e/es.aspx? S = 1403 & E = 7247 & elq = 199d2ebb698c4ca28036d31a85661fa5
The system. Io. Path class in. Net has many useful static methods. You can use the following command to obtain a list of supported methods:
[System. Io. Path] | get-member-static
The following method demonstrates how to change the extension of a file:
[System. Io. Path]: changeextension ("test.txt", "PS1 ")
The above is from powershell.com
Powertip of the day from February 2 to 6