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
# Mastermind Game (with numbers) | |
# import Random for creating code | |
import random | |
# Create a three digit random number | |
def secretCode(): | |
secretCode = '' | |
for i in range(0, 3): | |
secretCode += str(random.randint(1, 9)) |
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
[system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null | |
$balloon = New-Object System.Windows.Forms.NotifyIcon | |
$path = Get-Process -id $pid | Select-Object -ExpandProperty Path | |
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path) | |
$balloon.Icon = $icon | |
$balloon.BalloonTipIcon = 'Info' | |
$balloon.BalloonTipText = 'Completed Operation' | |
$balloon.BalloonTipTitle = 'Done' | |
$balloon.Visible = $true | |
$balloon.ShowBalloonTip(10000) |
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
# Initialise machine name | |
$server = "<>" | |
# Get fixed drive info | |
$disks = Get-WmiObject -ComputerName $server -Class Win32_LogicalDisk -Filter "DriveType = 3"; | |
foreach($disk in $disks) | |
{ | |
$deviceID = $disk.DeviceID; | |
[float]$size = $disk.Size; |
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
# ==================================================================== | |
# Retrieve current or last user logon details for a list of machines | |
# Tom Latham (13/05/2010) | |
# ==================================================================== | |
Function Get-FileName | |
# Open file dialog box and select a file to import | |
{ | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
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 ------------- | |
Function Get-FileName | |
# Open file dialog box and select a file to import | |
{ | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | |
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog | |
$OpenFileDialog.filter = "Text Files (*.txt)| *.txt" # Set the file types visible to dialog |
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 -------------- | |
Function Set-Filename | |
# Set file name for saving export | |
{ | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | |
$SaveFileDialog = New-Object System.Windows.Forms.SaveFileDialog | |
$SaveFileDialog.Filter = "Text files (*.txt)|*.txt" | |
$SaveFileDialog.initialDirectory = "c:\" |
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
Variety of methods for pinging machines. |
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
'Create folder path recursively | |
Function GeneratePath(pFolderPath) | |
GeneratePath = False | |
If Not wFile.FolderExists(pFolderPath) Then | |
If GeneratePath(wFile.GetParentFolderName(pFolderPath)) Then | |
GeneratePath = True | |
Call wFile.CreateFolder(pFolderPath) | |
End If | |
Else | |
GeneratePath = True |
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
$Session = New-Object -ComObject Microsoft.Update.Session | |
$Searcher = $Session.CreateUpdateSearcher() | |
$HistoryCount = $Searcher.GetTotalHistoryCount() | |
$Searcher.QueryHistory(1,$HistoryCount) | | |
Select-Object Date, Title, 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
' ------------------------------------------------------------ | |
' Convert IP Address - convert IP Address to integer format | |
' ------------------------------------------------------------ | |
Function ConvertIP(IPAddress) | |
Dim IPnumber, IPArray, counter | |
IPArray = Split(IPAddress,".") | |
IPNumber = CDbl(0) | |
For counter = 0 To UBound(IPArray) |