Last active
August 3, 2022 20:17
-
-
Save FlintSable/ea43716ceac94228fada583a0ae73b79 to your computer and use it in GitHub Desktop.
Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Logger function usage | |
| # Create a folder in this directory \\sccm\sccm$\UpgradeLog | |
| # call the function like this | |
| # logger "string to log" | |
| function logger{ | |
| param( | |
| [string]$arg0 | |
| ) | |
| # define these values | |
| $path_to_log_folder = "\\scc\scc$\UpgradeLog" | |
| $name_of_folder = "TesterLog" | |
| $CPName = $Env:COMPUTERNAME | |
| $Username = (Get-WmiObject -Class Win32_ComputerSystem | select username).Username.Substring(5) | |
| $Username = (Get-Culture).TextInfo.ToTitleCase($Username) | |
| function Time { | |
| $d = Get-Date | |
| [string]$dw = $d.DayOfWeek | |
| $dw = $dw.Substring(0,3) | |
| $dw + " " + $d | |
| } | |
| Add-Content $path_to_log_folder\$name_of_folder\$CPName-$Username.txt "$(time) $CPName $Username $arg0" | |
| } | |
| logger "test call this wherever you need test 1" | |
| logger "test call this wherever you need test 2" | |
| logger "test call this wherever you need test 3" | |
| logger "test call this wherever you need test 4" | |
| logger "test call this wherever you need test 5" | |
| logger "test call this wherever you need test 6" | |
| logger "test call this wherever you need test 7" | |
| logger "test Close out log test 8" | |
| logger "---------------------------------------" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| psExec \\\\WS886 cmd | |
| psExec \\WS886 cmd | |
| psExec '\\WS886' cmd | |
| https://community.spiceworks.com/how_to/78664-remove-local-printer-on-a-remote-machine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment