- <
- .SYNOPSIS
- This script gets all the exceptions you can trap by PowerShell
- .DESCRIPTION
- This script looks at all the loaded assemblies to get all
- the exceptions you can trap/catch using PowerShell. The
- display only covers those parts of the .NET framework are loaded.
- .NOTES
- File Name : Show-Exceptions.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Psh> .\Show-Exceptions.ps1 -Summary
- In 69 loaded assemblies, you have 418 exceptions:
-
- .EXAMPLE
- Psh> .\Show-Exceptions.ps1
- In 69 loaded assemblies, you have 418 exceptions:
-
- Name FullName
- ---- --------
- _Exception System.Runtime.InteropServices._Exception
- AbandonedMutexException System.Threading.AbandonedMutexException
- AccessViolationException System.AccessViolationException
- ...
-
-
-
- [CMDLETBINDING()]
- Param (
- [switch] $summary
- )
-
- $assemblies = [System.AppDomain]::CurrentDomain.GetAssemblies()
- $exceptions = $Assemblies | ForEach {
- $_.GetTypes() | where { $_.FullName -Match "System$filter.*Exception$" } }
-
-
- "In {0} loaded assemblies, you have {1} exceptions:" -f $assemblies.count, $exceptions.count
- If (-not $summary) {
- $Exceptions | sort name | format-table name, fullname
- }
Technorati Tags:
Exceptions
- <
- .SYNOPSIS
- This script reports on whether Lync should
- automatically start on a machine when a user
- logs in.
- .DESCRIPTION
- This script looks in the registry at a chosen machine
- to determine if the Lync client should automatically
- attempt to login when a user logs onto that system.
- .NOTES
- File Name : Get-LyncAutoLogonStatus
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- Lync 2010 or later
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Psh> .\Get-LyncAutoLogonStatus
- Automatically start Lync when I log on to Windows: True
-
-
-
- [Cmdletbinding()]
- Param (
- [string] $computer = "Cookham8.Cookham.net")
-
-
-
- $registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("CurrentUser", $computer)
- $key = $registry.OpenSubKey("SOFTWARE\Microsoft\Communicator", $True)
-
-
- Write-Host "Automatically start Lync when I log on to Windows:",`
- ([boolean] $key.GetValue("AutoRunWhenLogonToWindows",$null))
- <
- .SYNOPSIS
- This script defines a function that sets autologon
- .DESCRIPTION
- Autologon enables the system to logon after a reboot without
- you needing to enter credentials. This is an ideal scenario
- for lab or training room systems. This script defines
- a function that sets a userid/password and autologon.
- .NOTES
- File Name : Set-AdminLogon
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Psh> New-AdminLogon -user cookham\tfl -password 'JerryGarciaR0cks!'
- Auto logon created for [Cookham\tfl] with password: [JerryGarciaR0cks]
-
-
-
- Function New-AdminLogon {
-
- [cmdletbinding()]
- Param(
- [string] $User = $(Throw 'No user id specified'),
- [string] $Password = $(Throw 'No password specified')
- )
-
-
- $RegPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
-
-
- Set-ItemProperty -Path $RegPath -Name AutoAdminLogon -Value 1
-
-
- Set-ItemProperty -Path $RegPath -Name DefaultUserName -Value $User
- Set-ItemProperty -Path $regPath -Name DefaultPassword -Value $Password
-
-
- Write-Host ("Auto logon [{0}] set to password: [{1}]" -f $user, $password)
- }
-
- Set-AdminLogon -User 'Cookham\tfl' -Password 'JerryGarciaR0cks'
- <
- .SYNOPSIS
- This script defines a function that removes autologon
- .DESCRIPTION
- Autologon enables the system to logon after a reboot without
- you needing to enter credentials. This is an ideal scenario
- for lab or training room systems. This script defines
- a function that removes the autologon registry keys
- .NOTES
- File Name : Remove-AdminLogon
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Psh> Remove-AdminLogon
- Auto logon settings removed
-
- Function Remove-AdminLogon {
- [Cmdletbinding()]
- Param()
-
- $RegPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
-
- Remove-ItemProperty -Path $RegPath -Name AutoAdminLogon
-
- Remove-ItemProperty -Path $RegPath -Name DefaultUserName
- Remove-ItemProperty -Path $RegPath -Name DefaultPassword
-
- Write-Host ("Auto logon removed")
- }
- Remove-AdminLogon
- <
- .SYNOPSIS
- This script defines a function that sets autologon
- .DESCRIPTION
- Autologon enables the system to logon after a reboot without
- you needing to enter credentials. This is an ideal scenario
- for lab or training room systems. This script defines
- a function that sets a userid/password and autologon. It does NOT
- check to see if the value entries already exist.
- .NOTES
- File Name : Set-AutoAdminLogon
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Psh> Set-AutoAdminLogon -user cookham\tfl -password 'JerryGarciaR0cks!'
- Auto logon set for [Cookham\tfl] with password: [JerryGarciaR0cks]
-
-
-
- Function Set-AdminLogon {
-
- [cmdletbinding()]
- Param(
- [string] $User = $(Throw 'No user id specified'),
- [string] $Password = $(Throw 'No password specified')
- )
-
-
- $RegPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
-
-
- New-ItemProperty -Path $RegPath -Name AutoAdminLogon -Value 1 -EA 0
-
-
- New-ItemProperty -Path $RegPath -Name DefaultUserName -Value $User -EA 0
- New-ItemProperty -Path $regPath -Name DefaultPassword -Value $Password -EA 0
-
-
- Write-Host ("Auto logon set for [{0}] with password: [{1}]" -f $user, $password)
- }
-
- Set-AdminLogon -User 'Cookham\tfl' -Password 'JerryGarciaR0cks'