full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/PoshCode/Exchange AutoReply Admin_1.ps1 | Exchange AutoReply Admin_1.ps1 | <#
.NOTES
Name : Exchange Automatic Replies Administrator.ps1
Author : Bryan Jaudon <bryan.jaudon@gmail.com>
Version : 1.0
Date : 11/23/2012
.SYNOPSIS
Provides a graphical front-end to the Get-MailboxAutoReplyConfiguration and
Set-MailboxAutoReplyConfiguration Exch... |
PowerShellCorpus/PoshCode/Stop-ProcessRemote.ps1 | Stop-ProcessRemote.ps1 | Function Stop-ProcessRemote()
{
<#
.SYNOPSIS
Stops a process on a remote computer
.DESCRIPTION
Uses WMI to connect to a remote computer and terminate a process.
Assumes the user has administrative priviledges on the remote
computer.
.NOTES
Author : Brian Wahoff
Requires : Powershell V2
.PARAM... |
PowerShellCorpus/PoshCode/Write-ScriptVariables.ps1 | Write-ScriptVariables.ps1 | function Write-ScriptVariables {
$globalVars = get-variable -scope Global | % { $_.Name }
Get-Variable -scope Script | Where-Object { $globalVars -notcontains $_.Name } | Where-Object { $_.Name -ne 'globalVars' } | Out-String
}
|
PowerShellCorpus/PoshCode/Log 4 SP easy restore .ps1 | Log 4 SP easy restore .ps1 | ####### Log deletions in all sites in a web application ######
############# http://iLoveSharePoint.com ##################
############## by Christian Glessner ######################
################ begin config #################
# Url of the web application to audit. Don't forget to activate the delete audi... |
PowerShellCorpus/PoshCode/Get-NTFSPermissions.ps1 | Get-NTFSPermissions.ps1 | <#
.SYNOPSIS
Author:..Vidrine
Date:....2013.01.14
.DESCRIPTION
Thanks to http://jfrmilner.wordpress.com/
Specify target host and root directory. The script will then recursively check for all folders and report on their NTFS permissions.
Output is stored in a custom object, that is then exported... |
PowerShellCorpus/PoshCode/New-DynamicVariable.ps1 | New-DynamicVariable.ps1 | ##############################################################################\n##\n## New-DynamicVariable\n##\n## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNOPSIS\n\nCrea... |
PowerShellCorpus/PoshCode/netcast show downloader_1.ps1 | netcast show downloader_1.ps1 | cd M:\\Files\\Netcasts\\ShowName # switch to the diretory to store your content
Import-Module BitsTransfer # enable BITS on host machine as a file transfer method
$start=47 # start epidode number
$end=170 # end epidode number
$url="http://download.domain.com/episodes/" # URL of the download up to the ... |
PowerShellCorpus/PoshCode/Backup full.ps1 | Backup full.ps1 | # Ańadimos el modulo de exchange
If ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null)
{
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
}
$lista= ""
[int]$tam=30
$server = "MAILBOX"
$discos=get-wmiobject -class win32_volume -filter "DriveType=3" -computer $server
$databases... |
PowerShellCorpus/PoshCode/79de7fa1-6c33-48aa-b0e4-a5f72def9bcc.ps1 | 79de7fa1-6c33-48aa-b0e4-a5f72def9bcc.ps1 | ################################################################
#
# PC Info v1.0 for SNOS(http://www.snos.ru/)
# (c)2009 by MakcoH(http://twitter.com/MakcoH)
# Script gathers information about remote PC using SCCM and WMI
#
################################################################
# Get... |
PowerShellCorpus/PoshCode/Shift Operators(Correct).ps1 | Shift Operators(Correct).ps1 | #requires -version 2.0
Add-Type @"
public class Shift {
public static int Right(int x, int count) { return x >> count; }
public static uint Right(uint x, int count) { return x >> count; }
public static long Right(long x, int count) { return x >> count; }
public static ulong Right(ulong x, int ... |
PowerShellCorpus/PoshCode/ConvertTo-MultiArray_2.ps1 | ConvertTo-MultiArray_2.ps1 | function ConvertTo-MultiArray {
<#
.Notes
NAME: ConvertTo-MultiArray
AUTHOR: Tome Tanasovski
Website: http://powertoe.wordpress.com
Twitter: http://twitter.com/toenuff
Version: 1.0
CREATED: 11/5/2010
LASTEDIT:
11/5/2010 1.0
Initial Release
11/5/2010 1.1
Removed array parameter and passes a ... |
PowerShellCorpus/PoshCode/PowerShell Talk Chickens_1.ps1 | PowerShell Talk Chickens_1.ps1 | #The PowerShell Talk
#Virtualization Congress 2009
#
#The Chicken Counter Script
#Get our cretendials
#More on credential stores: http://professionalvmware.com/2009/04/09/posh-article-of-the-week-secure-credential-storage/
$credentials = Get-VICredentialStoreItem -File "c:\\scripts\\really_secure_file.xml"
... |
PowerShellCorpus/PoshCode/Send-HTMLFormattedEmail_1.ps1 | Send-HTMLFormattedEmail_1.ps1 | #-------------------------------------------------
# Send-HTMLFormattedEmail
#-------------------------------------------------
# Usage: Used to send an HTML Formatted Email that is based on an XSLT template.
#-------------------------------------------------
function Send-HTMLFormattedEmail{
param ( [string]... |
PowerShellCorpus/PoshCode/FTP module.ps1 | FTP module.ps1 | <#
.Synopsis
Utilities for communicating with FTP server.
#>
function Get-ScriptPath {
Split-Path $myInvocation.ScriptName
}
Import-Module (Join-Path (Get-ScriptPath) common.psm1) -Force
<#
.Synopsis
Lists contents of directory via FTP.
.Parameter oath
URL of directory to list.
.Para... |
PowerShellCorpus/PoshCode/Create SP2010 Farm V_5.ps1 | Create SP2010 Farm V_5.ps1 | ############################################################################
## Create-SPFarm
## V 0.3
## Jos.Verlinde
############################################################################
Param ( [String] $Farm = "SP2010",
[String] $SQLServer = $env:COMPUTERNAME,
[String] $Passphrase = "pass@word1"... |
PowerShellCorpus/PoshCode/Resize Console Window.ps1 | Resize Console Window.ps1 | ##
## Author : Roman Kuzmin
## Synopsis : Resize console window/buffer using arrow keys
##
function Size($w, $h)
{
New-Object System.Management.Automation.Host.Size($w, $h)
}
function resize()
{
Write-Host '[Arrows] resize [Esc] exit ...'
$ErrorActionPreference = 'SilentlyContinue'
for($ui = $Hos... |
PowerShellCorpus/PoshCode/Find Local Group Members_4.ps1 | Find Local Group Members_4.ps1 | # Author: Hal Rottenberg
# Purpose: Find matching members in a local group
# Used tip from RichS here: http://powershellcommunity.org/Forums/tabid/54/view/topic/postid/1528/Default.aspx
# Change these two to suit your needs
$ChildGroups = "Domain Admins", "Group Two"
$LocalGroup = "Administrators"
$MemberName... |
PowerShellCorpus/PoshCode/New-Event_1.ps1 | New-Event_1.ps1 | function New-Event {
<#
.Synopsis
Generates a new event from a plain English string
.Description
Takes a plain English date-time string like "Scrum every day at 9am" or "Lunch every other Tuesday at noon" and turns it into an event object (see notes).
.Example
New-Event Lunch every other Friday at 11:45... |
PowerShellCorpus/PoshCode/QAD.psm1.ps1 | QAD.psm1.ps1 | #
# Module manifest for module 'QAD'
#
# Generated from: Quest.ActiveRoles.ADManagement
#
# Generated on: 1/28/2011
#
@{
# Script module or binary module file associated with this manifest
ModuleToProcess = 'Quest.ActiveRoles.ArsPowerShellSnapIn.dll'
# Version number of this module.
ModuleVersion = '1.... |
PowerShellCorpus/PoshCode/Reverse filename sequenc_3.ps1 | Reverse filename sequenc_3.ps1 | # Reverse filename sequence v 0.9
# Author: Sean Wendt
#
# This script will rename a sequenced set of files in a directory.
# For example, you have foobar01.jpg, foobar02.jpg, foobar03.jpg
# -- it will reverse the order, so the last file is now 01, the second to last 02, etc..
#
# Limitations: -You cannot us... |
PowerShellCorpus/PoshCode/Logoff all users_1.ps1 | Logoff all users_1.ps1 | function RemoveSpace([string]$text) {
$private:array = $text.Split(" ", `
[StringSplitOptions]::RemoveEmptyEntries)
[string]::Join(" ", $array) }
$quser = quser
foreach ($sessionString in $quser) {
$sessionString = RemoveSpace($sessionString)
$session = $sessionString.split()
i... |
PowerShellCorpus/PoshCode/Find FSMO Roles.ps1 | Find FSMO Roles.ps1 | $DCs = ([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).DomainControllers
$DCs | % { if ($_.Roles -ne '') {
"Server $_ has roles:"
""
foreach ($role in $_.roles) {
$role.tostring().padleft($role.tostring().length + 10)
}
""
}
}
|
PowerShellCorpus/PoshCode/Get-SNMPHost.ps1 | Get-SNMPHost.ps1 | Param($VC,$ESXCreds=(Get-Credential))
Write-Host "Connecting to VC to get ESX Hosts"
Connect-VIServer $VC | out-null
$ESXHosts = Get-VMHost
foreach($esxhost in $ESXHosts)
{
Write-Host " Connecting to $esxhost"
Connect-VIServer $esxhost.name -cred $ESXCreds | out-null
$SNMPHost = Get-VMHostSnmp
... |
PowerShellCorpus/PoshCode/User Logon details.ps1 | User Logon details.ps1 | ########
#
#Used for enumerating local workstation for user details
#Author: Adam Liquorish
#Date: 12/10/11
########
########Define Parameters
param(
[Parameter(Mandatory=$true,
HelpMessage="Enter Path for output ie c:\\Temp\\output.html.")]
[ValidateNotNullOrEmpty()]
[string]$outputpath=$(Read-Host -pr... |
PowerShellCorpus/PoshCode/egg_timer.ps1 | egg_timer.ps1 | function GenerateForm {
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
$form_main = New-Object System.Windows.Forms.Form
$reset_button = New-Object System.Windows.Forms.Button
$label1 = New-Object Sys... |
PowerShellCorpus/PoshCode/Set-PsBreakPointLastErro.ps1 | Set-PsBreakPointLastErro.ps1 | Set-StrictMode -Version Latest\n\n$lastError = $error[0]\nSet-PsBreakpoint $lastError.InvocationInfo.ScriptName `\n $lastError.InvocationInfo.ScriptLineNumber
|
PowerShellCorpus/PoshCode/Get-Parameter_15.ps1 | Get-Parameter_15.ps1 | function Get-Parameter
{
[OutputType('System.String')]
[CmdletBinding()]
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[String]$Command,
[Parameter(Position=1)]
[String[]]$Name=@('*'),
[Parameter()]
[ValidateSet('Name','Type','Pos','BV','... |
PowerShellCorpus/PoshCode/Find-MSDN.ps1 | Find-MSDN.ps1 | function New-UrlFile
{
param( $URL = "http://www.google.com")
$UrlFile = [system.io.Path]::ChangeExtension([system.io.Path]::GetTempFileName(),".url")
$UrlFileContents = `
"[InternetShortcut]",
"URL=$URL"
$UrlFileContents | Set-Content -Path $UrlFile
Get-Item $UrlFile
}
function Find-MSDN
{
par... |
PowerShellCorpus/PoshCode/Search Files by Date.ps1 | Search Files by Date.ps1 | <#
Author: Matt Schmitt
Date: 11/30/12
Version: 1.0
From: USA
Email: ithink2020@gmail.com
Website: http://about.me/schmittmatt
Twitter: @MatthewASchmitt
Description
A script for finding files in a directory by Last Accessed Date.
#>
Write-Host "Enter Root Direc... |
PowerShellCorpus/PoshCode/Join-Collections 2.1.ps1 | Join-Collections 2.1.ps1 | #requires -version 2.1
####################################################################################################
## Version History:
##
## Version 2.1 Use a hashtable to improve join performance significantly
## Version 2.0 Added Join-Object and removed dependency on ConvertFrom-Hashtable
## ... |
PowerShellCorpus/PoshCode/Email-ExpiringADAccounts_2.ps1 | Email-ExpiringADAccounts_2.ps1 | Function GetMsgBody {
Write-Output @"
<p>Dear $name,</p>
Your ABC network account is about to expire.<br/>
Please email helpdesk@abc.com or simply hit 'reply', and include the following details to have your account extended.<br/>
<br/>
Your name:<br/>
The department you currently volunteer in:<br/>
... |
PowerShellCorpus/PoshCode/ConvertTo-ASCII_2.ps1 | ConvertTo-ASCII_2.ps1 | #requires -version 2.0
#region Help
<#
.SYNOPSIS
Automation script for file character set format conversion to ASCII encoding.
.DESCRIPTION
Script for automating the conversion of files to ASCII format. Good for if you've used Out-File without specifying the
encoding. Which would make a Unicode formatted... |
PowerShellCorpus/PoshCode/Test 2.ps1 | Test 2.ps1 | \nTesting from PowerShell 2
|
PowerShellCorpus/PoshCode/Get_Set Signature 2.0.ps1 | Get_Set Signature 2.0.ps1 | #Requires -version 2.0
## Authenticode.psm1 updated for PowerShell 2.0 (with time stamping)
####################################################################################################
## Wrappers for the Get-AuthenticodeSignature and Set-AuthenticodeSignature cmdlets
## These properly parse paths, so they... |
PowerShellCorpus/PoshCode/Update phone # in AD.ps1 | Update phone # in AD.ps1 | #------------------------------------------------------------------------------
# Strips off the '1-' prefix from phone numbers stored in Active Directory.
# Requires 'ActiveRoles Management Shell for Active Directory' from Quest
# Software.
#-------------------------------------------------------------------------... |
PowerShellCorpus/PoshCode/Export-PSCredential_3.ps1 | Export-PSCredential_3.ps1 | # Author: Hal Rottenberg <hal@halr9000.com>
# Url: http://halr9000.com/article/tag/lib-authentication.ps1
# Purpose: These functions allow one to easily save network credentials to disk in a relatively
# secure manner. The resulting on-disk credential file can only [1] be decrypted
# by the same user account... |
PowerShellCorpus/PoshCode/AddTo-HostsFile_2.ps1 | AddTo-HostsFile_2.ps1 | function AddTo-HostsFile{
<#
.DESCRIPTION
This function checks to see if an entry exists in the hosts file.
If it does not, it attempts to add it and verifies the entry.
.EXAMPLE
Networkign.AddTo-Hosts -IPAddress 192.168.0.1 -HostName MyMachine
.EXTERNALHELP
None.
.FORWARDHELPTARGE... |
PowerShellCorpus/PoshCode/d2585c36-111c-47e6-87c4-568d89c06c20.ps1 | d2585c36-111c-47e6-87c4-568d89c06c20.ps1 | hi
i want a script in powershell that talks to the sharepoint and takes two arguments one is Ip address or server name other is config.xml file.
It checks if server exists and if yes it asks for user name and password and display error to the user accordingly . also it checks for duplicate entries in config.xml ... |
PowerShellCorpus/PoshCode/Write-DataTable.ps1 | Write-DataTable.ps1 | #######################
<#
.SYNOPSIS
Writes data only to SQL Server tables.
.DESCRIPTION
Writes data only to SQL Server tables. However, the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a DataTable instance or read with a IDataReader instance.
.INPUTS... |
PowerShellCorpus/PoshCode/b4865a35-f8b9-4235-90a9-91f1b81e8dc1.ps1 | b4865a35-f8b9-4235-90a9-91f1b81e8dc1.ps1 | [reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null
[reflection.assembly]::LoadWithPartialName("Microsoft.Office.Server") | out-null
[reflection.assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") | out-null
@@#NOTE: I've set strict crawl freshness/crawl duration/success rati... |
PowerShellCorpus/PoshCode/ESX host NTP Settings_1.ps1 | ESX host NTP Settings_1.ps1 | <#======================================================================================
File Name : ESX-NTP.ps1
Original Author : Kenneth C. Mazie
:
Description : This is a VMware PowerCLI script for synchronizing NTP settings across
: all ESX hosts in a Vi... |
PowerShellCorpus/PoshCode/Feeds Module.ps1 | Feeds Module.ps1 | #Requires -Version 2.0
DATA loc {
# en-US
convertfrom-stringdata @'
RootName = (Root)
FolderCaption = Folder: {0}
FeedCaption = Feed: {0}
MarkReadStatus = Marking all items read
DownloadStatus = Downloading all items
AsyncDownloadStatus = Beginning download of all items
'@
}
# Import local... |
PowerShellCorpus/PoshCode/Convert-BounceToX_2.ps1 | Convert-BounceToX_2.ps1 | # $Id: Convert-BounceToX500.ps1 610 2010-11-16 00:39:19Z jon $
# $Revision: 610 $
#.Synopsis
# Convert Bounce to X500
#.Description
# Convert URL Encoded address in a Bounce message to an X500 address
# that can be added as an alias to the mail-enabled object
#.Parameter bounceAddress
# URL Encoded bounce... |
PowerShellCorpus/PoshCode/SharpSSH Module_1.ps1 | SharpSSH Module_1.ps1 | ##################################################
# cmdlets
##################################################
#-------------------------------------------------
# New-SharpSession
#-------------------------------------------------
# Usage: New-SharpSession -?
#-------------------------------------------------... |
PowerShellCorpus/PoshCode/Set-ADUserRandomPassword_1.ps1 | Set-ADUserRandomPassword_1.ps1 | ###########################################################################"
#
# NAME: Set-ADUserRandomPassword.ps1
#
# AUTHOR: Jan Egil Ring
# EMAIL: jan.egil.ring@powershell.no
#
# COMMENT: This script are used to set a random password for the Active Directory user with the username provided by the user who ru... |
PowerShellCorpus/PoshCode/Start-Demo 3.3.3.ps1 | Start-Demo 3.3.3.ps1 | ## Start-Demo.ps1
##################################################################################################
## This is an overhaul of Jeffrey Snover's original Start-Demo script by Joel "Jaykul" Bennett
##
## I've switched it to using ReadKey instead of ReadLine (you don't have to hit Enter each time)
## ... |
PowerShellCorpus/PoshCode/Xml Module _1.6.ps1 | Xml Module _1.6.ps1 | #requires -version 2.0
# Improves over the built-in Select-XML by leveraging Remove-XmlNamespace http`://poshcode.org/1492
# to provide a -RemoveNamespace parameter -- if it's supplied, all of the namespace declarations
# and prefixes are removed from all XML nodes (by an XSL transform) before searching.
# IMP... |
PowerShellCorpus/PoshCode/Hash Checker_1.ps1 | Hash Checker_1.ps1 | #.Synopsis
# Test the HMAC hash(es) of a file
#.Description
# Takes the HMAC hash of a file using specified algorithm, and optionally, compare it to a baseline hash
#.Example
# Test-Hash npp.5.3.1.Installer.exe -HashFile npp.5.3.1.release.md5
#
# Searches the provided hash file for a line matching the "... |
PowerShellCorpus/PoshCode/Get-Uptime.ps1 | Get-Uptime.ps1 | Function Get-Uptime {
<#
.SYNOPSIS
Displays Uptime since last reboot
.PARAMETER Computername
.EXAMPLE
Get-Uptime Server1
.EXAMPLE
"Server1", "Server2"|Get-Uptime
.EXAMPLE
(Get-Uptime Sever1)."Time Since Last Reboot"
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$true,P... |
PowerShellCorpus/PoshCode/Compare-DellUpdates.ps1 | Compare-DellUpdates.ps1 | #Requires -version 2
#Author: Nathan Linley
#More details: http://myitpath.blogspot.com/2012/02/dell-components-check-for-updates-via.html
#OUTPUT FORMAT:
#Component : FlashBIOS Updates
#path : PE2850_BIOS_WIN_A07.EXE
#vendorVersion : A07
#currentversion : A05
#releaseDate : May 23, 2008
... |
PowerShellCorpus/PoshCode/Servers in Computers OU.ps1 | Servers in Computers OU.ps1 | function checkADSI()
{ $ADSIStat = "Servers in Computer OU"
$error.clear()
$errcnt = 0
$objDomain = New-Object System.DirectoryServices.DirectoryEntry("LDAP://CN=Computers,DC=domain,DC=com")
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher($objDomain)
$objSearcher.Filter = ("(o... |
PowerShellCorpus/PoshCode/Prevent-Screensaver_2.ps1 | Prevent-Screensaver_2.ps1 | #########################################################
# Prevent-Screensaver
#########################################################
# This script "presses" a keyboard key every minute
# for specified number of minutes which makes
# Windows "think" you are at your desktop
# so the screensaver does not start ... |
PowerShellCorpus/PoshCode/ShowUI Weather Widget_2.ps1 | ShowUI Weather Widget_2.ps1 | ## And a slick weather widget using Yahoo's forecast and images
New-UIWidget -AsJob {
Grid {
Rectangle -RadiusX 10 -RadiusY 10 -StrokeThickness 0 -Width 170 -Height 80 -HorizontalAlignment Left -VerticalAlignment Top -Margin "60,40,0,0" -Fill {
LinearGradientBrush -Start "0.5,0" -End "0.5,... |
PowerShellCorpus/PoshCode/Set-TopMost_1.ps1 | Set-TopMost_1.ps1 | #Requires -Version 2.0
$signature = @"
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public static IntPtr FindWindow(string windowName){
return FindWindow(null,windowName);
}
[DllImport("user32.dll")]
public static extern bool Se... |
PowerShellCorpus/PoshCode/format-iislog for AWStat_1.ps1 | format-iislog for AWStat_1.ps1 | param
(
[Parameter(
Mandatory=$true,
Position = 0,
ValueFromPipeline=$true,
HelpMessage="Specifies the path to the IIS *.log file to import. You can also pipe a path to Import-Iss-Log."
)]
[ValidateNotNullOrEmpty()]
[string]
$Path,
[Parameter(
Mandatory=$true,
Position = 1,
Value... |
PowerShellCorpus/PoshCode/WPFTableSpace.ps1 | WPFTableSpace.ps1 | #Usage: ./WPFTableSpace.ps1 'Z002\\SqlExpress' AdventureWorks
#Note: Requires .NET 3.5, Visifire Charts (tested on v2.1.0), Powerboots (tested on v0.1), and SQLPSX (tested on v1.5)
param($sqlserver=$(throw 'sqlserver is required.'),$dbname=$(throw 'dbname is required.'),$top=10)
$libraryDir = Convert-Path (Resolve... |
PowerShellCorpus/PoshCode/Resolve-Aliases _4.7.ps1 | Resolve-Aliases _4.7.ps1 | #requires -version 2.0
## ResolveAliases Module v 1.7
########################################################################################################################
## Sample Use:
## Resolve-Aliases Script.ps1 | Set-Content Script.Resolved.ps1
## ls *.ps1 | Resolve-Aliases -Inplace
##############... |
PowerShellCorpus/PoshCode/Netapp SDK_1.ps1 | Netapp SDK_1.ps1 | #Jason Ochoa
#3/3/2010
#This script requires the DLL from the website below.
#http://communities.netapp.com/docs/DOC-1110
#connection to file filer
#$null = [reflection.assembly]::loadfile('C:\\admin\\ManageOntap.dll')
#$pvflrtst = New-Object netapp.manage.naserver('pvflrtst',1,0)
#$pvflrtst.setadminuser("z057... |
PowerShellCorpus/PoshCode/HEX string to SID string.ps1 | HEX string to SID string.ps1 | Function EndianReverse ($strHex)
{
$intCounter=$strHex.length-1
do
{
$reverse=$reverse+$strHex.substring($intCounter-1, 2)
$intCounter=$intCounter-2
}
until ($intCounter -eq -1)
return $reverse
}
Function hex2sid ($strHex)
{
$intSidVersionLength = 2
$intSubAuthorityCountLength = 2
$in... |
PowerShellCorpus/PoshCode/Product key_3.ps1 | Product key_3.ps1 | from System import Array, Char, Console
from System.Collections import ArrayList
from Microsoft.Win32 import Registry
def DecodeProductKey(digitalProductID):
map = ("BCDFGHJKMPQRTVWXY2346789").ToCharArray()
key = Array.CreateInstance(Char, 29)
raw = ArrayList()
i = 52
while i < 67:
raw... |
PowerShellCorpus/PoshCode/Set-Wallpaper (CTP2)_1.ps1 | Set-Wallpaper (CTP2)_1.ps1 | #requires -version 2.0
## Set-Wallpaper - set your windows desktop wallpaper
###################################################################################################
## Usage:
## Set-Wallpaper "C:\\Users\\Joel\\Pictures\\Wallpaper\\Dual Monitor\\mandolux-tiger.jpg" "Tile"
## ls *.jpg | get-random ... |
PowerShellCorpus/PoshCode/Test-ADCredentials_1.ps1 | Test-ADCredentials_1.ps1 | Function Test-ADCredentials {
Param($username, $password, $domain)
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain
$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext($ct, $domain)
New-Object PSOb... |
PowerShellCorpus/PoshCode/The PowerShell Talk Xen_1.ps1 | The PowerShell Talk Xen_1.ps1 | #The PowerShell Talk
#Demo 2 - VM Easy Bake Oven
#XenServer
#Connect to XenServer
Get-Credential | connect-Xenserver -Url http://XenServer_URL/sdk
#Create the new VM
Create-XenServer:VM -NameLabel "Dave" -VCPUsAtStartup 1 -MemoryDynamicMax 536870912 -MemoryStaticMax 536870912 -MemoryDynamicMin 536870912 -Memo... |
PowerShellCorpus/PoshCode/Get-APOD.ps1 | Get-APOD.ps1 | <#
.SYNOPSIS
Gets the Astronomy Picture of the Day and sets it as your wallpaper.
.DESCRIPTION
Get-Apod parses the Astronomy Picture of the Day website and downloads the current day's image. It then sets the image as the desktop wallpaper for the system.
.LINK
http://antwrp.gsfc.nasa.gov/apod/astropix.html
.... |
PowerShellCorpus/PoshCode/353941de-a44d-4d1b-a022-bffae3d94ed3.ps1 | 353941de-a44d-4d1b-a022-bffae3d94ed3.ps1 | function Select-Alive {param( [object]$InputObject,
[string]$Property,
[int32]$Requests = 3)
PROCESS {
if ($InputObject -eq $null) {$In = $_} else {$In = $InputObject}
if ($In.GetType().Name -eq "String") {
$HostName = $In
}
elseif (($In | Get-Member | Where-Object {$In.Name -eq $... |
PowerShellCorpus/PoshCode/IE Proxy Toggle (Silent)_2.ps1 | IE Proxy Toggle (Silent)_2.ps1 | # Process command line parameter (if present).
[bool] $DISABLE_PROXY = $false;
foreach ($param in $MyInvocation.UnboundArguments) {
if ($param -like 'disable') { $DISABLE_PROXY = $true; }
}
# Apply/refresh the organization's default proxy settings.
[string] $proxyServer = '###.###.###.###:####';
... |
PowerShellCorpus/PoshCode/Enable-MailboxJunkEmail.ps1 | Enable-MailboxJunkEmail.ps1 | # Author: Jon Webster
# Name: Enable-MailboxJunkEmail
# Created: 1/27/2009
#
# Version: 1.0
# History: 1.0 01/27/2009 Initial version
#
# 18.11.2010 BRF Update for Microsoft Exchange SP3, Cookie Canary
param(
$Identity,
[string]$CasURL,
[string]$User,
[string]$Password,
$DomainController,
[switch... |
PowerShellCorpus/PoshCode/SCOM-CreatePortMonitor.ps1 | SCOM-CreatePortMonitor.ps1 | param($serverName,$portNumber,$pollIntervalSeconds,$watcherNodes,$displayName,$targetMp)
function GetPortMonitoringTemplate
{
$criteria = "Name = 'Microsoft.SystemCenter.SyntheticTransactions.TCPPortCheck.Template'";
$templateCriteria = new-object Microsoft.EnterpriseManagement.Configuration.MonitoringTempla... |
PowerShellCorpus/PoshCode/SSL Oblivious Web Client.ps1 | SSL Oblivious Web Client.ps1 | function New-TrustAllWebClient {
# Create a compilation environment
$Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
$Compiler=$Provider.CreateCompiler()
$Params=New-Object System.CodeDom.Compiler.CompilerParameters
$Params.GenerateExecutable=$False
$Params.GenerateInMemory=$True
$Params.IncludeDe... |
PowerShellCorpus/PoshCode/Get-Exception.ps1 | Get-Exception.ps1 | <#
.Synopsis
Outputs .NET exception information along with their summary information if available.
.Description
Spins all loaded types in all loaded assemblies and will return any Exception types that
match the filter if specified. Because the script only spins loaded assemblies, if you want
the script to sea... |
PowerShellCorpus/PoshCode/VM Performance Report - .ps1 | VM Performance Report - .ps1 | <#
.SYNOPSIS
The script creates an HTML report for given vSphere VM's, that contains VM performance data over a given period. The script then emails the report to a given address.
.DESCRIPTION
The script requires an input file, supplied as an argument to the script. The first line of this file contains an e... |
PowerShellCorpus/PoshCode/finddupe_8.ps1 | finddupe_8.ps1 | function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.OpenRead();
$hashByteArray = $hashA... |
PowerShellCorpus/PoshCode/Exporting SQLData to CSV.ps1 | Exporting SQLData to CSV.ps1 | #Connection Strings
$Database = "Database"
$Server = "SQLServer"
#SMTP Relay Server
$SMTPServer = "smtp.domain.com"
#Export File
$AttachmentPath = "C:\\SQLData.csv"
# Connect to SQL and query data, extract data to SQL Adapter
$SqlQuery = "SELECT * FROM dbo.Test_Table"
$SqlConnection = New-Object System.Data.Sq... |
PowerShellCorpus/PoshCode/Tag-Alert (SCOM).ps1 | Tag-Alert (SCOM).ps1 | # Tags alert with PrincipalName, Severity and MP name in Custom fields.
# Use in OpsMgr Command Shell.
# Original script from Marco Shaw.
# Changed by Stefan Stranger
# Date created 13-09-2008
$alerts = get-alert | where {$_.principalname -ne $null -and $_.resolutionstate -eq "0"}
foreach($alert in $alerts)
... |
PowerShellCorpus/PoshCode/WPF PingMonitor for 2.0.ps1 | WPF PingMonitor for 2.0.ps1 | if(!(Get-Command New-BootsWindow -EA SilentlyContinue)) {
# Add-PsSnapin PoshWpf
Import-Module PowerBoots
Add-BootsContentProperty 'DataPoints', 'Series'
#[Void][Reflection.Assembly]::LoadFrom( (Convert-Path (Resolve-Path "~\\Documents\\WindowsPowershell\\Libraries\\WPFVisifire.Charts.dll")) )
Add-B... |
PowerShellCorpus/PoshCode/Boots Hierarchical Bind.ps1 | Boots Hierarchical Bind.ps1 | ######## CSV DATA #############
# Save the following data to a csv.
City,Team
"Los Angeles","Lakers"
"Los Angeles","Clippers"
"New York","Knicks"
"New York","Liberty"
"Sacramento","Kings"
######## CODE #################
$teams = Import-Csv "C:\\testdata.csv"
[array]$cities = $teams | %{$_.City} ... |
PowerShellCorpus/PoshCode/Get-NaNfsExport.ps1 | Get-NaNfsExport.ps1 | # Glenn Sizemore ~ www . Get-Admin . Com
# Example Powershell function to get the NFS Exports from a NetApp Filer
# First you'll need to download the OnTap SDK 3.5 : http://communities.netapp.com/docs/DOC-1365
# within the download your interested in .\\manage-ontap-sdk-3.5\\lib\\DotNet\\ManageOntap.dll
# Next... |
PowerShellCorpus/PoshCode/ConvertTo-Hex_9.ps1 | ConvertTo-Hex_9.ps1 | # Ported from C# technique found here: http://forums.asp.net/p/1298956/2529558.aspx
param ( [string]$SidString )
# Create SID .NET object using SID string provided
$sid = New-Object system.Security.Principal.SecurityIdentifier $sidstring
# Create a byte array of the proper length
$sidBytes = New-Object byte[] ... |
PowerShellCorpus/PoshCode/HttpRest.ps1 | HttpRest.ps1 | ## Http Rest
####################################################################################################
## The first implementation of the HttpRest module, as a bunch of script functions
## Based on the REST api from MindTouch's Dream SDK
##
## INSTALL:
## You need log4net.dll mindtouch.core.dll mindto... |
PowerShellCorpus/PoshCode/ScheduleGPOBackups.ps1 | ScheduleGPOBackups.ps1 | Import-Module grouppolicy
#region ConfigBlock
# What domain are we going to backup GPOs for?
$domain = "psd267.wednet.edu"
# Where are we going to store the backups?
$gpoBackupRootDir = "c:\\gpoBackups"
# As I plan to do a new backup set each month I'll setup the directory names to reflect
# the year and month i... |
PowerShellCorpus/PoshCode/Get-TopProcess.ps1 | Get-TopProcess.ps1 | ## poll-process.ps1
## Continuously display a process list, sorted
## by the desired criteria.
##
## usage: poll-process [sortCriteria] [pollInterval]
##
## sortCriteria must be one of "Id", "ProcessName", "MainWindowTitle",
## "Processor", "Disk", or "WorkingSet"
## pollIn... |
PowerShellCorpus/PoshCode/Easy Migration Tool v2.0.ps1 | Easy Migration Tool v2.0.ps1 | #Generated Form Function
function GenerateForm {
########################################################################
# Code Generated By: Richard Yaw
# Generated On: 09/12/2010
#
# Easy Migration Script for VMware (Version 2.0)
# - Added a "Reload Tasks" feature.
# - Fixed issue with the Undo feature for S... |
PowerShellCorpus/PoshCode/Invoke-MoveRequest.ps1 | Invoke-MoveRequest.ps1 | ###########################################################################
#
# NAME: Invoke-MoveRequest.ps1
#
# AUTHOR: Jan Egil Ring
# EMAIL: jer@powershell.no
#
# COMMENT: Script to use when migrating mailboxes to Microsoft Exchange Server 2010 Cross-Forest. Prepares user objects already
# moved to... |
PowerShellCorpus/PoshCode/Google Chromium Download_2.ps1 | Google Chromium Download_2.ps1 | <#
.Synopsis
Download Google Chromium if there is a later build.
.Description
Download Google Chromium if there is a later build.
http://poshcode.org/2422
#>
Set-StrictMode -Version Latest
Import-Module bitstransfer
# comment out when not debugging
$VerbosePreferenc... |
PowerShellCorpus/PoshCode/Remove diacritics.ps1 | Remove diacritics.ps1 | ### Grťgory Schiro, 2009
### <summary>
### Removes diacritics from string.
### </summary>
### <param name="String">String containing diacritics</param>
function Remove-Diacritics([string]$String)
{
$objD = $String.Normalize([Text.NormalizationForm]::FormD)
$sb = New-Object Text.StringBuilder
fo... |
PowerShellCorpus/PoshCode/Get-CryptoBytes_2.ps1 | Get-CryptoBytes_2.ps1 | function Get-CryptoBytes {
#.Synopsis
# Generate Cryptographically Random Bytes
#.Description
# Uses RNGCryptoServiceProvider to generate arrays of random bytes
#.Parameter Count
# How many bytes to generate
#.Parameter AsString
# Output hex-formatted strings instead of byte arrays
param(
[Parameter(Va... |
PowerShellCorpus/PoshCode/Get-NaNfsExport_1.ps1 | Get-NaNfsExport_1.ps1 | # Glenn Sizemore ~ www . Get-Admin . Com
# Example Powershell function to get the NFS Exports from a NetApp Filer
# First you'll need to download the OnTap SDK 3.5 : http://communities.netapp.com/docs/DOC-1365
# within the download your interested in .\\manage-ontap-sdk-3.5\\lib\\DotNet\\ManageOntap.dll
# Next... |
PowerShellCorpus/PoshCode/Hack ESX MOTD_1.ps1 | Hack ESX MOTD_1.ps1 | $screen = @"
You see here a virtual switch. ------------ ------
#...........| |....|
--------------- ###------------ |...(|
|..%...........|########## ###-@...|
... |
PowerShellCorpus/PoshCode/DS L Order brneanew game.ps1 | DS L Order brneanew game.ps1 | # Version: 0.1
# Author: Stefan Stranger
# Description: Retrieve Dell Order Status
# Start Page Order Status USA: https://support.dell.com/support/order/status.aspx?c=us&cs=19&l=en&s=dhs&~ck=pn
# Start Page Order Status EMEA(nl): http://support.euro.dell.com/support/index.aspx?c=nl&l=nl&s=gen&~ck=bt
# Example Dell... |
PowerShellCorpus/PoshCode/Findup_9.ps1 | Findup_9.ps1 | using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
namespace Findup
{
public class FileInfoExt
{
public FileInfoExt(FileInfo fi)
... |
PowerShellCorpus/PoshCode/Asp.net-Using httpConext.ps1 | Asp.net-Using httpConext.ps1 | @@ Default.aspx
@@----------------
Partial Class _Default
Inherits System.Web.UI.Page
Dim var1 As String
Dim var2 As String
Protected Sub lnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnk.Click
Context.Items("Nome") = var1
Context.Items("Email") = var2
Server.Transfer("pagina... |
PowerShellCorpus/PoshCode/Script logging_1.ps1 | Script logging_1.ps1 | #region Log File Management
$ScriptName = $MyInvocation.mycommand.name
$LocalAppDir = "$(gc env:LOCALAPPDATA)\\PS_Data"
$LogName = $ScriptName.replace(".ps1", ".log")
$MaxLogFileSizeMB = 5 # After a log file reaches this size it will archive the existing and create a new one
trap
[Exception] {
sendl
"er... |
PowerShellCorpus/PoshCode/NPS Server Synchronize_1.ps1 | NPS Server Synchronize_1.ps1 | ###Network Policy Server Synchronization Script
#This script copies the configuration from the NPS Master Server and imports it on this server.
#The Account that this script runs under must have Local Administrator rights to the NPS Master.
#This was designed to be run as a scheduled task on the NPS Secondary Server... |
PowerShellCorpus/PoshCode/Ping Alert Script_2.ps1 | Ping Alert Script_2.ps1 | #Email Alert Parameters
$to = "user@mydomain.com"
$from = "unreachable@mydomain.com"
$smtpserver = "my_exchange_server"
#Array of computers to test
$Computers = ("comp1" , "comp2" , "comp3" , "comp4")
#Variable to hold INT value 0
$zero = 0
Foreach ($Computer in $Computers)
{
if... |
PowerShellCorpus/PoshCode/Windows Startup Script_4.ps1 | Windows Startup Script_4.ps1 | <#======================================================================================
File Name : Startup.ps1
Original Author : Kenneth C. Mazie
:
Description : This is a Windows start-up script with pop-up notification and checks to
: assure things are n... |
PowerShellCorpus/PoshCode/LibraryInputComparison.p.ps1 | LibraryInputComparison.p.ps1 | ## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n\nSet-StrictMode -Version Latest\n\n## Process each element in the pipeline, using a\n## foreach statement to visit each element in $input\nfunction Get-InputWithForeach($identifier)\n{\n Write-Host "Beginning InputWit... |
PowerShellCorpus/PoshCode/Invoke-Switch v0.9.ps1 | Invoke-Switch v0.9.ps1 | New-Variable castDictionaryEntries
[System.Func[System.Collections.IEnumerable, System.Collections.Generic.IEnumerable[System.Collections.DictionaryEntry]]] `
$castDictionaryEntries = [System.Delegate]::CreateDelegate(
[System.Func[System.Collections.IEnumerable, System.Collections.Generic.IEnumerable[Sy... |
PowerShellCorpus/PoshCode/Test-Server_1.ps1 | Test-Server_1.ps1 | Function Test-Server{
[cmdletBinding()]
param(
[parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName,
[parameter(Mandatory=$false)]
[switch]$CredSSP,
[Management.Automation.PSCredential] $Credential)
begin{
$total = Get-Date
$results = @()
if($credssp){if(!($credential)){Wri... |
PowerShellCorpus/PoshCode/IniFile Functions 1.0.ps1 | IniFile Functions 1.0.ps1 | function Get-IniSection($inifile,$section)
{
$sections = select-string "^\\[.*\\]" $inifile
if(!$section) {
return $sections | %{$_.Line.Trim("[]")}
}
$start = 0
switch($sections){
{$_.Line.Trim() -eq "[$section]"}{
$start = $_.LineNumber -1
}
defaul... |
PowerShellCorpus/PoshCode/Get-LeaderBoard.ps1 | Get-LeaderBoard.ps1 | <#
.SYNOPSIS
Pulls down the leaderboards for the 2011 Scripting Games
.DESCRIPTION
Quick and dirty script to pull down the leaderboards for the 2011 scripting games.
Can choose either beginner or advanced via a command line switch.
.PARAMETER Level
The leaderboard to parse
.EXAMPLE
Get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.