This file contains 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
public static string Version | |
{ | |
get | |
{ | |
Assembly asm = Assembly.GetExecutingAssembly(); | |
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); | |
return String.Format("{0}.{1}.{2}.{3}", fvi.ProductMajorPart, fvi.ProductMinorPart, fvi.ProductBuildPart, fvi.ProductPrivatePart); | |
} | |
} |
This file contains 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
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) | |
{ | |
// Get the subdirectories for the specified directory. | |
DirectoryInfo dir = new DirectoryInfo(sourceDirName); | |
DirectoryInfo[] dirs = dir.GetDirectories(); | |
if (!dir.Exists) | |
{ | |
throw new DirectoryNotFoundException( | |
"Source directory does not exist or could not be found: " |
This file contains 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
Process[] processes = Process.GetProcesses(); | |
foreach(Process process in processes) { | |
Console.WriteLine("PID: " + process.Id); | |
Console.WriteLine("Name: " + process.Name); | |
Console.WriteLine("Modules:"); | |
foreach(ProcessModule module in process.Modules) { | |
Console.WriteLine(module.FileName); | |
} |
This file contains 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
Process.Start("explorer.exe", "/select," + <folder>); |
This file contains 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
$Outlook = New-Object -ComObject Outlook.Application | |
$Mail = $Outlook.CreateItem(0) | |
$Mail.To = "[email protected]" | |
$Mail.Subject = "Action" | |
$Mail.Body ="Pay rise please" | |
$Mail.Send() |
This file contains 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
# | |
# | |
# References: | |
# http://ardalis.com/How-Can-I-View-MSMQ-Messages-and-Queues | |
# to see queue, search via "Computer Mamagment" | |
# | |
# simular sample: http://blogs.msdn.com/b/sajay/archive/2010/03/18/powershell-script-to-create-an-msmq.aspx | |
# | |
[Reflection.Assembly]::LoadWithPartialName("System.Messaging") |
This file contains 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
# | |
# http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell | |
# | |
# | |
# $zipFileName contains path to new .zip file | |
# $sourceDir contains path to folder with source data | |
# | |
ZipFiles $zipFileName $sourceDir |
This file contains 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
. "$PSScriptRoot\genericFunctions.ps1" | |
# | |
# | |
# | |
<actual powershell source, can use functions from file genericFunction.ps1> |
This file contains 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 SendEmailWithEmbeddedImage([String] $to, [String] $subject, [String] $body, [String] $attachment, [String] $imageFile) | |
{ | |
#$htmlHeader = "<HEAD>Text<B>BOLD</B> <span style='color:#E36C0A'>Color Text</span></HEAD>" | |
$htmlText = "<HTML>{0}</HTML><img src='cid:{1}'>" | |
$Outlook = New-Object -ComObject Outlook.Application | |
$Mail = $Outlook.CreateItem(0) | |
$Mail.To = $to #"[email protected]" | |
$Mail.Subject = $subject | |
$Mail.HTMLBody = [string]::Format($htmlText, $body, ExtractFileName $imageFile) |
This file contains 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
# | |
# sample: | |
#$title = "MyChart" | |
#$size = "700x350" | |
#$url = CreateChartUrl $valueArray $labelArray $title $size | |
# | |
function CreateChartUrl ($valueArray, $labelArray, [string]$title, $size) { | |
$chartType = "lc" | |
$chartData = [string]::join(",", $valueArray) |
OlderNewer