$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\winevt\Channels\Microsoft-Windows-PowerShell/Operational" # get the default access permission for the standard security log... $sddlSecurity = ((wevtutil gl security) -like'channelAccess*').Split(' ')[-1] # get the current permissions $sddlPowerShell = (Get-ItemProperty-Path$Path).ChannelAccess # make a backup of the current permissions New-ItemProperty-Path$Path-Name ChannelAccessBackup -Value$sddlPowerShell-ErrorAction Ignore # apply the hardened permissions Set-ItemProperty-Path$Path-Name ChannelAccess -Value$sddlSecurity # restart service to take effect Restart-Service-Name EventLog -Force
"You entered a credential for {0}."-f$Credential.UserName # now you could do something with $Credential, i.e. submit it to # other cmdlets that support the -Credential parameter # i.e. # Get-WmiObject -Class Win32_BIOS -ComputerName SomeComputer -Credential $Credential
Remove-Variable-Name Credential }
现在不再能获取到变量:
1 2 3 4 5 6 7 8
PS> Remove-Variable-Name Credential
PS> . Connect-Server-Credential tobias You entered a credential for Tobias.
"You entered a credential for {0}."-f$Credential.UserName # now you could do something with $Credential, i.e. submit it to # other cmdlets that support the -Credential parameter # i.e. # Get-WmiObject -Class Win32_BIOS -ComputerName SomeComputer -Credential $Credential
"You entered a credential for {0}."-f$Credential.UserName # now you could do something with $Credential, i.e. submit it to # other cmdlets that support the -Credential parameter # i.e. # Get-WmiObject -Class Win32_BIOS -ComputerName SomeComputer -Credential $Credential
And if you have Admin privileges, you can even dump the jobs from other users, including internal accounts. This way you’ll see updates and other things that are on their way to you: 如果您有管理员特权,您甚至可以从其它用户那儿转储所有任务,包括内部账号。通过这种方式您可以查看进度等其它信息: