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
function Get-Bittage { | |
$Bits = [IntPtr]::size * 8 | |
} |
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
Write-Host "Press any key to exit." | |
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludEKeyDown") |
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
#$Secure = <your secure string> | |
$Plain = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($Secure)) |
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
function Show-DialogMessage($message = 'Default message') | |
{ | |
$null = [Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); | |
$answer = [System.Windows.Forms.MessageBox]::Show($message, 'Informational Message',[Windows.Forms.MessageBoxButtons]::OK,[Windows.Forms.MessageBoxIcon]::Information); | |
return [String]$answer | |
} |
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
function Write-Log { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position=0,Mandatory=$true)][String]$Message, | |
[String]$Path = '', | |
[Int]$MaxFileSize = 1024000, # In bytes | |
[Switch]$NoNewLine, | |
[Switch]$Continued | |
) |
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
# List of hostnames | |
$computers = 'e:\computerlist.txt' | |
# Username and password to change to | |
$Username = '' | |
$NewPassowrd = '' | |
$ExistingCredentials = Get-Credential -Message 'Existing credentials' | |
foreach($Computer in (Get-Content $Computers)) { | |
echo "Changing: $($Computer)" |
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
function Enable-TSDuplicateToken { | |
<# | |
.SYNOPSIS | |
Duplicates the Access token of lsass and sets it in the current process thread. | |
.DESCRIPTION | |
The Enable-TSDuplicateToken CmdLet duplicates the Access token of lsass and sets it in the current process thread. | |
The CmdLet must be run with elevated permissions. | |
.EXAMPLE |
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
<# | |
.SYNOPSIS | |
Stores a username/password PSCredential in an XML file. | |
.DESCRIPTION |
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
function Test-Administrator | |
{ | |
$user = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} |
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
function Send-Notification { | |
param( | |
$Status | |
) | |
Send-MailMessage -To '' -From "" -SmtpServer ''` | |
-Subject "$($env:computername) $($Drive) RAID $($Status)" -Body "$($Drive)RAID status is: $($Status)" | |
} | |
# Drive letter to check |
OlderNewer