powershell 电源外壳

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 电源外壳相关的知识,希望对你有一定的参考价值。

# 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 "---------------------------------------"
psExec \\\\WS886 cmd
psExec \\WS886 cmd
psExec '\\WS886' cmd

https://community.spiceworks.com/how_to/78664-remove-local-printer-on-a-remote-machine

以上是关于powershell 电源外壳的主要内容,如果未能解决你的问题,请参考以下文章