full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PoshCode/Disable-SSLValidation.ps1
Disable-SSLValidation.ps1
function Disable-SSLValidation { <# .SYNOPSIS Disables SSL certificate validation .DESCRIPTION Disable-SSLValidation disables SSL certificate validation by using reflection to implement the System.Net.ICertificatePolicy class. Author: Matthew Graeber (@mattifestation) License: BSD 3-Clause .N...
PowerShellCorpus/PoshCode/Get-SQLSaturdaySessions_1.ps1
Get-SQLSaturdaySessions_1.ps1
function Get-SQLSaturdaySessionList { param( [string] $Number = "111", $GetUnscheduled ) $baseUrl = "http://sqlsaturday.com/" + $Number $url = $baseUrl + "/schedule.aspx" $page = $null try { Write-Verbose "Initiating WebClient" ...
PowerShellCorpus/PoshCode/04180226-a26b-47be-abbd-9eb998596807.ps1
04180226-a26b-47be-abbd-9eb998596807.ps1
<#===================================================== SYNOPSIS Create an Excel workbook for a teacher. The workbook contains a worksheet for each class. =====================================================#> <#===================================================== RETRIEVE CURRENT USER'S LOGON Prefer API to ...
PowerShellCorpus/PoshCode/Test-Certificate_1.ps1
Test-Certificate_1.ps1
##################################################################### # Test-Certificate.ps1 # Version 0.9 # # Tests specified certificate for certificate chain and revocation # # Vadims Podans (c) 2009 # http://www.sysadmins.lv/ ##################################################################### #requires -...
PowerShellCorpus/PoshCode/vSphere Resultant Privs_1.ps1
vSphere Resultant Privs_1.ps1
# Need the Quest ActiveRoles cmdlets for this one. Add-PSSnapin Quest.ActiveRoles* -ea SilentlyContinue function Get-Groups { param($principal) # Start with this principal's base set of groups. Write-Verbose "Checking principal $principal" $groups = Get-QADUser $principal | Get-QADMemberOf # Groups ca...
PowerShellCorpus/PoshCode/Get MOSS User Profile_2.ps1
Get MOSS User Profile_2.ps1
function Get-UserProfile($accountName) { [reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null [reflection.assembly]::LoadWithPartialName("Microsoft.Office.Server") | out-null $upm =[Microsoft.Office.Server.UserProfiles.UserProfileManager]( [Microsoft.Office.Server.ServerContext]::D...
PowerShellCorpus/PoshCode/SharpSsh Functions_1.ps1
SharpSsh Functions_1.ps1
## USING the binaries from: ## http://downloads.sourceforge.net/sharpssh/SharpSSH-1.1.1.13.bin.zip [void][reflection.assembly]::LoadFrom( (Resolve-Path "~\\Documents\\WindowsPowerShell\\Libraries\\Tamir.SharpSSH.dll") ) ## NOTE: These are bare minimum functions, and only cover ssh, not scp or sftp ## also, ...
PowerShellCorpus/PoshCode/repr_2.ps1
repr_2.ps1
function repr { [CmdletBinding()] [OutputType([string])] Param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] $InputObject) process { if($null -eq $InputObject) { $PSCmdlet.WriteObject('$null') } elseif($InputObject -is ...
PowerShellCorpus/PoshCode/Exchange PST Export.ps1
Exchange PST Export.ps1
#Load Exchange PS Snapin If (@(Get-PSSnapin -Registered | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"} ).count -eq 1) { If (@(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"} ).count -eq 0) { Write-Host "Loading Exchange Snapin Ple...
PowerShellCorpus/PoshCode/Activation Context API.ps1
Activation Context API.ps1
<# By Adam Driscoll 12/14/2012 Twitter: @adamdriscoll More Information: http://csharpening.net/?p=1427 Description: Functions for entering and exiting an activation context. This provides support for registration free COM in PowerShell. #> Add-Type -TypeDefinition ' namespace Driscoll { using System...
PowerShellCorpus/PoshCode/Get-RecentLogons.ps1
Get-RecentLogons.ps1
Add-PSSnapin -Name Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue # Location of the CSV file created. $fileLocation = "C:\\temp\\logon.csv" # Get the Current Date $CURRENTDATE=GET-DATE # Number of days to check $COMPAREDATE = $CURRENTDATE.AddDays(-30) # Your AD Domain $server = "ad.domai...
PowerShellCorpus/PoshCode/Check HBA status .ps1
Check HBA status .ps1
########################################################################################### # Title: Check HBA status # Filename: Check-HBA.ps1 # Created by: Alberto Damiano # Date: June 2009 # Version: 1.0 ########################################################################################...
PowerShellCorpus/PoshCode/Select-CSVString.ps1
Select-CSVString.ps1
# NAME # Select-CSVString # # SYNOPSIS # Convert CSV files to custom objects with properties # # SYNTAX # Select-CSVString -pattern <string[]> -files (ls *) [-StartDate <DateTime>] [-EndDate <DateTime>] param ([regex]$pattern,$files=("$($exinstall)TransportRoles\\Logs\\AgentLog","$($exinstall.substring(...
PowerShellCorpus/PoshCode/Beginner event 10 _2.ps1
Beginner event 10 _2.ps1
# # Summer 2009 Scripting games # Beginner Event 10 - The 1,500-Meter race # http://blogs.technet.com/heyscriptingguy/archive/2009/06/18/hey-scripting-guy-2009-scripting-games-event-10-details-beginner-and-advanced-1-500-meter-race.aspx # # ToDo: In this event, you must write a script that will count down from th...
PowerShellCorpus/PoshCode/sudo for Powershell_3.ps1
sudo for Powershell_3.ps1
## sudo.ps1 # # Authors: rbellamy, pezhore, mrigns, This guy: http://tsukasa.jidder.de/blog/2008/03/15/scripting-sudo-with-powershell, # other powershell peoples # # Sources: # http://tsukasa.jidder.de/blog/2008/03/15/scripting-sudo-with-powershell # http://www.ainotenshi.org/%E2%80%98sud...
PowerShellCorpus/PoshCode/Fix VPC Console.ps1
Fix VPC Console.ps1
# Fix the VPC options left and top position for console $today = get-date -Format "yyyyMMdd" $now = Get-Date -format "hhmmss" $today_now = Get-Date -format "yyyyMMdd_hhmmss" @" Fix the Virtual PC Console options for left and top position " Makes a backup copy of "${env:appdata}\\Microsoft\\Virtual PC\\Opt...
PowerShellCorpus/PoshCode/get-lockedtime.ps1
get-lockedtime.ps1
param ( [parameter(position=0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] $ComputerName ) Begin { $alreadybegan = $false; function WmiDateToDotnet { param($date); if($date.length -ne 25) { throw New-Object Argum...
PowerShellCorpus/PoshCode/SearchZIP_2.psm1 .ps1
SearchZIP_2.psm1 .ps1
function SearchZIPfiles { <# .SYNOPSIS Search for (filename) strings inside compressed ZIP or RAR files (V2.2). .DESCRIPTION In any directory containing a large number of ZIP/RAR compressed Web Page files this procedure will search each individual file name for simple text strings, listing both the source RAR...
PowerShellCorpus/PoshCode/Spin-Busy_1.ps1
Spin-Busy_1.ps1
## Spin-Busy displays a "spinning" character with each step reflecting an individual pipeline object being passed through. ## The current cursor position, fg/bg colors, screen width, etc. can be specified or automatically detected. ## ## This is *very* loosly adapted from Out-Working by Joel Bennett (http://powershe...
PowerShellCorpus/PoshCode/Select-CSVString_2.ps1
Select-CSVString_2.ps1
# # NAME # Select-CSVString # # SYNOPSIS # Convert CSV files to custom objects with properties # # SYNTAX # Select-CSVString -pattern <string[]> -files (ls *) [-StartDate <DateTime>] [-EndDate <DateTime>] param ([regex]$pattern,$files=("$($exinstall)TransportRoles\\Logs\\AgentLog","$($exinstall.substri...
PowerShellCorpus/PoshCode/SharpSSH Module.ps1
SharpSSH Module.ps1
################################################## # cmdlets ################################################## #------------------------------------------------- # New-SharpSession #------------------------------------------------- # Usage: New-SharpSession -? #-------------------------------------------------...
PowerShellCorpus/PoshCode/Get-FSMORoleOwner_3.ps1
Get-FSMORoleOwner_3.ps1
Function Get-FSMORoleOwner { <# .SYNOPSIS Retrieves the list of FSMO role owners of a forest and domain .DESCRIPTION Retrieves the list of FSMO role owners of a forest and domain .NOTES Name: Get-FSMORoleOwner Author: Boe Prox DateCreated: 06/9/2011 .EXAMPLE ...
PowerShellCorpus/PoshCode/get-SQLInstanceInfo_2.ps1
get-SQLInstanceInfo_2.ps1
function get-SQLInstanceInfo2 { param ( [Parameter(Mandatory=$True)][string]$ComputerName ) $InstanceInfos = @() $Instances = (new-object 'microsoft.sqlserver.management.smo.Wmi.ManagedComputer' "$ComputerName").Services | where-object{$_.type -eq 'SqlServer'} foreach($Instance in $Instances )...
PowerShellCorpus/PoshCode/ActiveDirectoryFunctions_1.ps1
ActiveDirectoryFunctions_1.ps1
#.SYNOPSIS # Gets a directory entry from ActiveDirectory based on the login user name function Get-ADUser { [CmdletBinding()] param([string]$UserName=${Env:userName}) $ads = New-Object System.DirectoryServices.DirectorySearcher([ADSI]'') $ads.filter = "(&(objectClass=Person)(samAccountName=$UserName))" ...
PowerShellCorpus/PoshCode/Run-Defrag_3.ps1
Run-Defrag_3.ps1
# Run-Defrag # Defragments the targeted hard drives. # # Args: # $server: A target Server 2003 or 2008 system # $drive: An optional drive letter. If this is blank then all # drives are defragmented # $force: If this switch is set then a defrag will be forced # even if the drive is lo...
PowerShellCorpus/PoshCode/Colorize Subversion SVN.ps1
Colorize Subversion SVN.ps1
## SVN STAT colorizer - http://www.overset.com/2008/11/18/colorized-subversion-svn-stat-powershell-function/ function ss () { $c = @{ "A"="Magenta"; "D"="Red"; "C"="Yellow"; "G"="Blue"; "M"="Cyan"; "U"="Green"; "?"="DarkGray"; "!"="DarkRed" } foreach ( $svno in svn stat ) { if ( $c.ContainsKey($svno.ToString(...
PowerShellCorpus/PoshCode/be1eed1f-2503-4aa5-b552-787f15259255.ps1
be1eed1f-2503-4aa5-b552-787f15259255.ps1
@@---------------------logoff_clientside_interactive.ps1----------------- #powershell -ExecutionPolicy Unrestricted logoff_clientside_interactive.ps1 $ErrorActionPreference = "silentlycontinue" $mycreds = (Get-Credential) Invoke-Command -ComputerName terminalserver -Credential $mycreds { &"C:\\Program Files\\int...
PowerShellCorpus/PoshCode/Get Exchange DB Stats.ps1
Get Exchange DB Stats.ps1
# requires -version 2.0 # # get-exstats.ps1 # # returns various statistics on databases # # Author: rfoust@duke.edu # Modified: March 12, 2012 # # This has only been tested with Exchange 2010 param([string]$server=$env:computername.tolower(), [string]$database="NotSpecified", [switch]$all, [switch]$noemail,...
PowerShellCorpus/PoshCode/Get-BinarySum.ps1
Get-BinarySum.ps1
function Get-BinarySum { <# .SYNOPSIS Performs binary addition of two Int32 values. .DESCRIPTION If a numeric overflow occurs in PowerShell, an error is generated making it impossible to perform binary addition. Get-BinarySum will add two Int32 numbers together and if the result exceeds [Int32]::MaxValue, the...
PowerShellCorpus/PoshCode/iSCSI Module.ps1
iSCSI Module.ps1
# Copyright (c) 2011 Code Owls LLC, All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, copy, mod...
PowerShellCorpus/PoshCode/Update VM Tools_1.ps1
Update VM Tools_1.ps1
######################################################## # Created by Brian English # for Charlotte County Government # No warranty suggested or implied ######################################################## ######################################################## #connect to VirtualCenter server (i.e. virtua...
PowerShellCorpus/PoshCode/Resizer of pictures_2.ps1
Resizer of pictures_2.ps1
[reflection.assembly]::LoadWithPartialName("System.Drawing") $SizeLimit=1280 # required size of picture's long side $logfile="resizelog.txt" # log file for errors $toresize=$args[0] # list of directories to find and resize images. can be empty if ([string]$toresize -eq &#8220;&#8221;) { # if scr...
PowerShellCorpus/PoshCode/60e46e16-ef39-4620-84a5-bc955433e811.ps1
60e46e16-ef39-4620-84a5-bc955433e811.ps1
[void]([reflection.assembly]::LoadWithPartialName("Microsoft.office.server")) $serverContext = [Microsoft.Office.Server.ServerContext]::Default $upm = [Microsoft.Office.Server.UserProfiles.UserProfileManager]$serverContext @@ $upm.psbase.properties | ? { $_.isvisibleonviewer } | select DisplayName, name, displa...
PowerShellCorpus/PoshCode/Get-WebSite_5.ps1
Get-WebSite_5.ps1
function Get-WebSite { <# .SYNOPSIS Retrieves information about a website. .DESCRIPTION Retrieves information about a website. .PARAMETER Url URL of the website to test access to. .PARAMETER UseDefaultCredentials Use the currently authenticated user's credentials .PARAMETER Proxy Us...
PowerShellCorpus/PoshCode/Bulk Change AD Passwords.ps1
Bulk Change AD Passwords.ps1
#------------------------------------------------------------- # install http://www.quest.com/powershell/activeroles-server.aspx Add-PSSnapin Quest.ActiveRoles.ADManagement # CSV Format : NTAccountName,oldpassword,newpassword $UserList = Import-Csv c:\\temp\\users.csv # | select-object -first 2 $userli...
PowerShellCorpus/PoshCode/Get-WindowsExperience.ps1
Get-WindowsExperience.ps1
function Get-WindowsExperienceRating { #.Synopsis # Gets the Windows Experience Ratings #.Parameter ComputerName # The name(s) of the computer(s) to get the Windows Experience (WinSat) numbers for. [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] [string[...
PowerShellCorpus/PoshCode/validate an IP address_1.ps1
validate an IP address_1.ps1
# validate given IP address in $ip1 variable $ip1 = "192.168.22.455" ($ip1.split(".") | where-object { $_ -ge 1 -and $_ -le 255 } | Where-Object { $_ -match "\\d{1,3}"} | Measure-Object).count -eq 4
PowerShellCorpus/PoshCode/Findup_20.ps1
Findup_20.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; using System.Text.RegularExpressions; namespace Findup { public class FileLengthComparer : I...
PowerShellCorpus/PoshCode/Note, open Notepad++.ps1
Note, open Notepad++.ps1
# Limited Notepad++ support with the simple call 'Note' So long Notepad! function Note { <# .Synopsis Opens Notepad++ .Description Opens Notepad++ .Parameter File File name(s) to open, accepts wildcards. (absolute or relative path name) .Parameter MultiInstance Launch another Notepad++ instanc...
PowerShellCorpus/PoshCode/Prevent-Screensaver.ps1
Prevent-Screensaver.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/TabExpansion_12.ps1
TabExpansion_12.ps1
## Tab-Completion ################# ## Please dot souce this script file. ## In first loading, it may take a several minutes, in order to generate ProgIDs and TypeNames list. ## ## What this can do is: ## ## [datetime]::n<tab> ## [datetime]::now.d<tab> ## $a = New-Object "Int32[,]" 2,3; $b = "PowerShell","Pow...
PowerShellCorpus/PoshCode/Migrate UserFolder_3.ps1
Migrate UserFolder_3.ps1
param( $RootFolder = "\\\\server1\\users", $NewRootFolder = "\\\\server2\\users", $LogFolder = "C:\\Projects\\HomeDirs", $NewSubFolders = @("Documents","Favorites","Desktop","Links","Contacts"), $domain = "domain", [switch]$SetACL ) $UserFolders = gci -Path $RootFolder | ?{$_.PSIsContainer} $UserFolders | fore...
PowerShellCorpus/PoshCode/Invoke-SqlCmd_5.ps1
Invoke-SqlCmd_5.ps1
####################### <# .SYNOPSIS Runs a T-SQL script. .DESCRIPTION Runs a T-SQL script. Invoke-Sqlcmd2 only returns message output, such as the output of PRINT statements when -verbose parameter is specified .INPUTS None You cannot pipe objects to Invoke-Sqlcmd2 .OUTPUTS System.Data.DataTable .EXA...
PowerShellCorpus/PoshCode/Export top n SQLPlans.ps1
Export top n SQLPlans.ps1
<# ALZDBA SQLServer_Export_SQLPlans_SMO.ps1 Export top n consuming sqlplans (avg_worker_time=cpu) for a given SQLServer (SQL2005+) Instance #> #requires -version 2 #SQLServer instance $SQLInstance = 'yourserver\\yourinstance' #What number of plans to export per db ? [int]$nTop = 50 trap { # Handle all er...
PowerShellCorpus/PoshCode/Split-Job Version 1.2.ps1
Split-Job Version 1.2.ps1
#requires -version 1.0 ################################################################################ ## Run commands in multiple concurrent pipelines ## by Arnoud Jansveld - www.jansveld.net/powershell ## ## Basic "drop in" usage examples: ## - Functions that accept pipelined input: ## Without Spli...
PowerShellCorpus/PoshCode/Get Twitter RSS Feed_8.ps1
Get Twitter RSS Feed_8.ps1
param ([String] $ScreenName) $client = New-Object System.Net.WebClient $idUrl = "https://api.twitter.com/1/users/show.json?screen_name=$ScreenName" $data = $client.DownloadString($idUrl) $start = 0 $findStr = '"id":' do { $start = $data.IndexOf($findStr, $start + 1) if ($start -gt 0) { $s...
PowerShellCorpus/PoshCode/FTP upload_1.ps1
FTP upload_1.ps1
$File = "D:\\Dev\\somefilename.zip" $ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip" "ftp url: $ftp" $webclient = New-Object System.Net.WebClient $uri = New-Object System.Uri($ftp) "Uploading $File..." $webclient.UploadFile($uri, $File)
PowerShellCorpus/PoshCode/Get-DNSZoneRecords.ps1
Get-DNSZoneRecords.ps1
#========================================================================== # # NAME: Get-DNSZoneRecords.ps1 # AUTHOR: Saehrig, Steven (trac3r726) # DATE : 10/17/2008 # @@Requires PSHX-Sapien to be loaded for the Read-inputbox cmdlet. # @@Requires Powershell CTP 2 # # COMMENT: # Just comment out the variable...
PowerShellCorpus/PoshCode/Get-OwnerReport.ps1
Get-OwnerReport.ps1
##############################################################################\n##\n## Get-OwnerReport\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\nGets a l...
PowerShellCorpus/PoshCode/Get-ProcessCount_2.ps1
Get-ProcessCount_2.ps1
# Get-ProcessCount uses 2 main variables, server and process name. # Process name is typically the end exe, such as "svchost.exe" # Will accept unnamed args (Get-ProcessCount servername processname) # or named args (Get-ProcessCount -Computer servername -Process processname) Function Get-ProcessCount([string]$proce...
PowerShellCorpus/PoshCode/Inventory.ps1
Inventory.ps1
############################################################################ # # Collect.ps1 # Version: 0.2 # Script to Collect Information from (1)Subnet of PCs, or (2)List of PCs # By: Brad Blaylock # For: St. Bernards RMC # Date: 3-25-2010 # ################################################################...
PowerShellCorpus/PoshCode/Set-WinSchedule.ps1
Set-WinSchedule.ps1
# Set-WinSchedule # Written by Tome Tanasovski # http://powertoe.wordpress.com # version 1.0 # Created March 2010 # # Please read through the synopsis->Description to see the list of features that I hope to get # in a final release. If you choose to work on any of the issues by all means, but please contact #...
PowerShellCorpus/PoshCode/PowerBot _3.0.ps1
PowerBot _3.0.ps1
## PowerBot 2.0 ## A simple framework to get you started writing your own IRC bots in PowerShell #################################################################################################### ## Requires Meebey.SmartIrc4net.dll to be in your ...\\WindowsPowerShell\\Libraries\\ ## You can get Meebey.SmartIrc4n...
PowerShellCorpus/PoshCode/Write-Output.ps1
Write-Output.ps1
######################################################################## ## Copyright (c) Joel Bennett, 2010 ## Free for use under MS-PL, MS-RL, GPL 2, or BSD license. Your choice. function Write-Output { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] [Allow...
PowerShellCorpus/PoshCode/WhoAmI_1.ps1
WhoAmI_1.ps1
function whoami { [System.Security.Principal.WindowsIdentity]::GetCurrent().Name }
PowerShellCorpus/PoshCode/Findup_22.ps1
Findup_22.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; using System.Text.RegularExpressions; namespace Findup { public class FileLengthComparer : I...
PowerShellCorpus/PoshCode/Findup_14.ps1
Findup_14.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/Get-DistanceOnEarth.ps1
Get-DistanceOnEarth.ps1
function Get-DistanceOnEarth { <# .SYNOPSIS Calculates distance between points on the Earth. .DESCRIPTION Implementation of the Haversine equation to calculate distance over the surface of a sphere. .INPUTTYPE Pipeline object with the following parameters: LATITUDE1 LONGITUDE1 LATITUDE2 LONGITUDE2 #> ...
PowerShellCorpus/PoshCode/Change-ServicePassword.ps1
Change-ServicePassword.ps1
Param([string]$server,[string]$service,[string]$user,[string]$password) Begin{ function ChangeServicePassword{ Param([string]$srv,[string]$ms,[string]$usr,[string]$pwd) # Setup for WMI $class = "Win32_Service" $method = "change" $computer = $srv $filter...
PowerShellCorpus/PoshCode/SnapReminder.ps1
SnapReminder.ps1
# - SnapReminder V1.0 By Virtu-Al - http://virtu-al.net # # Please use the below variables to define your settings before use # $smtpServer = "mysmtpserver.mydomain.com" $MailFrom = "me@mydomain.com" $VISRV = "MYVISERVER" function Find-User ($username){ if ($username -ne $null) { $usr = (($username.spli...
PowerShellCorpus/PoshCode/TabExpansion_2.ps1
TabExpansion_2.ps1
## Tab-Completion ################# ## Please dot souce this script file. ## In first loading, it may take a several minutes, in order to generate ProgIDs and TypeNames list. ## What this can do is: ## ## [datetime]::n<tab> ## [datetime]::now.d<tab> ## $foo[0].<tab> ## $foo[0].n.b<tab> ## $function:a<tab> ##...
PowerShellCorpus/PoshCode/_CTP3_ Invoke-ISE_1.ps1
_CTP3_ Invoke-ISE_1.ps1
Set-Alias ISE Invoke-ISE function Invoke-ISE () <# .SYNOPSIS start ISE from the PS-commandline .DESCRIPTION start ISE provide files as parameters or per pipe-line .NOTES Author : Bernd Kriszio - http://pauerschell.blogspot.com/ Requires : PowerShell V2 CTP3 .EXAMPLE Invoke-ISE $foo...
PowerShellCorpus/PoshCode/SharePoint UserID grab_1.ps1
SharePoint UserID grab_1.ps1
## .\\SharePoint_Users_Read.ps1 "http://some.urlname.com/" "User Information List" "" ## .\\SharePoint_Users_Read.ps1 "http://some.urlname.com/" "User Information List" "user, someone" param( [string] $rqurdstrPath = $(Throw "--SharePoint Core Path required."), #required parameter [string] $rqurdstrListName = $(T...
PowerShellCorpus/PoshCode/Creating Bulk users.ps1
Creating Bulk users.ps1
The final.csv file is the name of file which i created and its located on the desktop of the window server. after running the script i received this error Import-Csv : Cannot open file "C:\\Users\\Administrator\\final.csv". At line:1 char:23 + $Password = Import-Csv <<<< final.csv| foreach { New-Mailbox -alias $_.A...
PowerShellCorpus/PoshCode/Check Modules path..ps1
Check Modules path..ps1
function Update-ModulePath { <# .Synopsis Command insures that path and the name of psm1 file are alike. .Description This function should help to troubleshoot modules. It loooks up path that should contain modules. For each .psm1 file found it checks if parent folder containing th...
PowerShellCorpus/PoshCode/Get-VMHostVersions.ps1
Get-VMHostVersions.ps1
#======================================================================== # Created on: 5/17/2012 2:03 PM # Created by: Clint Jones # Organization: Virtually Genius! # Filename: Get-VMHostVersions #======================================================================== #Import modules Add-PSSnapin "Vm...
PowerShellCorpus/PoshCode/DHCP Failover Script.ps1
DHCP Failover Script.ps1
:: Purpose: DHCP server Watchdog & Failover script. Read notes below :: Requirements: 1. Domain administrator credentials & "Logon as a batch job" rights :: 2. Proper firewall configuration to allow connection :: 3. Proper permissions on the DHCP backup directory :: Auth...
PowerShellCorpus/PoshCode/Set-LocalPassword_2.ps1
Set-LocalPassword_2.ps1
param( [switch]$Help , [string] $User , [string] $Password , [string[]] $ComputerNames = @() ) $usage = @' Get-OUComputerNames usage : [computerName1,computerName2,... | ] ./Set-LocalPassword.ps1 [-user] <userName> [-password] <password> [[-computers] computerName1,computerName2,...] returns : Sets lo...
PowerShellCorpus/PoshCode/Log ports used by app.ps1
Log ports used by app.ps1
####################################################################################################################### # File: LogPortsUsedByApplication.ps1 # # Version: 1.1 ...
PowerShellCorpus/PoshCode/Send-Growl 3.0.ps1
Send-Growl 3.0.ps1
## This is the first version of a Growl module (just dot-source to use in PowerShell 1.0) ## v 1.0 supports a very simple notice, and no callbacks ## v 2.0 supports registering multiple message types ## supports callbacks ## v 2.1 redesigned to be a module used from apps, rather than it's own "PowerGrowler" a...
PowerShellCorpus/PoshCode/Get-PrinterInfo.ps1
Get-PrinterInfo.ps1
$strComputer = "PrinterName" $Ports = get-wmiobject -class "win32_tcpipprinterport" -namespace "root\\CIMV2" -computername $strComputer $Printers = get-wmiobject -class "Win32_Printer" -namespace "root\\CIMV2" -computername $strComputer $ports | Select-Object Name,Hostaddress | Set-Variable port $Printers | Select-...
PowerShellCorpus/PoshCode/Boots UI Update Sample.ps1
Boots UI Update Sample.ps1
Import-Module PowerBoots # This simulates a download function, say Jaykul's Get-Webfile # You can output current progress for a large file, or if it's an array of links then out put the current (index/length)% # You will need to run the function as a background thread in order for it to not interfere with the UI t...
PowerShellCorpus/PoshCode/isMSDTC.ps1
isMSDTC.ps1
#MSDTC is needed by SQL Server Linked Servers #This script checks whether MSDTC has been configured for network access #See KB http://support.microsoft.com/default.aspx?scid=kb;en-us;816701 for steps to enable #All values except AllowOnlySecureRpcCalls should be true param($computerName=$env:computerName) #On an...
PowerShellCorpus/PoshCode/Get Network Utilization_1.ps1
Get Network Utilization_1.ps1
$cnt = 'Bytes Total/sec' $cat = 'Network Interface' $cnt2 = 'Current Bandwidth' foreach ($inst in ((new-object System.Diagnostics.PerformanceCounterCategory("network interface")).GetInstanceNames())){ $cur = New-Object system.Diagnostics.PerformanceCounter($cat,$cnt,$inst) $max = New-Object system.Diagnostics.Pe...
PowerShellCorpus/PoshCode/Get-ScriptDirectory.ps1
Get-ScriptDirectory.ps1
function Get-ScriptDirectory { $invocation = (Get-Variable MyInvocation -Scope 1).Value $script = [IO.FileInfo] $invocation.MyCommand.Path if ([IO.File]::Exists($script)) { Return (Split-Path $script.Fullname) } else { return $null } }
PowerShellCorpus/PoshCode/Stored Credential Code.ps1
Stored Credential Code.ps1
#STORED CREDENTIAL CODE $AdminName = Read-Host "Enter your Admin AD username" $CredsFile = "C:\\$AdminName-PowershellCreds.txt" $FileExists = Test-Path $CredsFile if ($FileExists -eq $false) { Write-Host 'Credential file not found. Enter your password:' -ForegroundColor Red Read-Host -AsSecureString | ConvertF...
PowerShellCorpus/PoshCode/Get-GroupMembership_2.ps1
Get-GroupMembership_2.ps1
## Get-DistinguishedName -- look up a DN from a user's (login) name function Get-DistinguishedName { Param($UserName) $ads = New-Object System.DirectoryServices.DirectorySearcher([ADSI]'') $ads.filter = "(&(objectClass=Person)(samAccountName=$UserName))" $s = $ads.FindOne() return $s.GetDirectoryEnt...
PowerShellCorpus/PoshCode/Get-CryptoBytes_1.ps1
Get-CryptoBytes_1.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/Read-InputBox.ps1
Read-InputBox.ps1
##############################################################################\n##\n## Read-InputBox\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\nRead user ...
PowerShellCorpus/PoshCode/Get-MailboxImportRequest_1.ps1
Get-MailboxImportRequest_1.ps1
# .Synopsis # Use the Get-MailboxImportRequestProgress cmdlet to view detailed information about pst import progress. # .Description # The Get-MailboxImportRequestProgress cmdlet displays statistics on imports currently in progress that help determine if a import is likely to complete successfully. To accureatel...
PowerShellCorpus/PoshCode/ActiveDirectoryFunctions_2.ps1
ActiveDirectoryFunctions_2.ps1
#.SYNOPSIS # Gets a directory entry from ActiveDirectory based on the login user name function Get-ADUser { [CmdletBinding()] param([string]$UserName=${Env:userName}) $ads = New-Object System.DirectoryServices.DirectorySearcher([ADSI]'') $ads.filter = "(&(objectClass=Person)(samAccountName=$UserName))" ...
PowerShellCorpus/PoshCode/3d3bbfa8-777b-4374-9eac-5350569d2cba.ps1
3d3bbfa8-777b-4374-9eac-5350569d2cba.ps1
param($Issue, $Credentials = $(Get-Credential), $BaseURI = "https://your.jira.server/jira") function ConvertTo-UnsecureString( [System.Security.SecureString][parameter(mandatory=$true)]$SecurePassword) { $unmanagedString = [System.IntPtr]::Zero; try { $unmanagedString = [Runtime.Interop...
PowerShellCorpus/PoshCode/Fix for datastore.ps1
Fix for datastore.ps1
#Generated Form Function function GenerateForm { ######################################################################## # THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK # OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER. # # Code Generated By: Richard ...
PowerShellCorpus/PoshCode/862a7a2f-5e6b-4cca-95e3-31247e664396.ps1
862a7a2f-5e6b-4cca-95e3-31247e664396.ps1
#Get information on everybodies inbox and spit it out with total sizes #in MB. Sorts the list by StorageLimitStatus #NOTE THAT I HAD TO USE ASCII WITH OUT-FILE AS NO OTHER ENCODING WOULD #PROPERLY IMPORT CSV INTO EXCEL #create a date var to stick in the filename $date = get-date -Format MM-dd-yyyy #create a ou...
PowerShellCorpus/PoshCode/init_repoclones.ps1
init_repoclones.ps1
<# .SYNOPSIS Makes a local copy of one or more remote svn repositories. .DESCRIPTION Makes a local copy of one or more remote svn repositories. .INPUTS None You cannot pipe objects to init-repoclones.ps1 .OUTPUTS None .EXAMPLE #> param ( [string[]] $Repos = @('protobuf', 'mb-unit', 'opennod...
PowerShellCorpus/PoshCode/Install-Patches.ps1
Install-Patches.ps1
<# Save this with a .PSM1 extension and use Import-Module to properly load the functions. ie: Install-Patches.psm1 Import-Module Install-Patches.psm1 #> #Validate user is an Administrator Write-Verbose "Checking Administrator credentials" If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.Window...
PowerShellCorpus/PoshCode/exclude properties_.ps1
exclude properties_.ps1
$server = "dcserver1.mafoberg.net" $session = new-pssession -computer $server -cred $creds icm -Session $session -ScriptBlock { import-module activedirectory (get-ADUser -filter "*" -properties GivenName, SurName, EmailAddress | select -ExcludeProperty PSComputerName, RunspaceId, PSShowComputerName ) ...
PowerShellCorpus/PoshCode/Check-LotusHealth.ps1
Check-LotusHealth.ps1
# ============================================================================================== # # Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 4.1 # # NAME: Check-LotusHealth.ps1 # # AUTHOR: Jeremy D. Pavleck , Pavleck.NET # DATE : 5/19/2008 # # COMMENT: This script...
PowerShellCorpus/PoshCode/Enable_Configure SNMP_3.ps1
Enable_Configure SNMP_3.ps1
#Powershell Script To Install SNMP Services (SNMP Service, SNMP WMI Provider) #Variables :) $pmanagers = "ADD YOUR MANAGER(s)" $commstring = "ADD YOUR COMM STRING" #Import ServerManger Module Import-Module ServerManager #Check If SNMP Services Are Already Installed $check = Get-WindowsFeature | Where-Objec...
PowerShellCorpus/PoshCode/Hash Checker.ps1
Hash Checker.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/List Windows File Shares.ps1
List Windows File Shares.ps1
Get-WmiObject Win32_Share -computerName SERVERNAME | Select Name, Caption, Path | Export-csv "c:\\temp\\SERVERNAME.csv" -NoTypeInformation
PowerShellCorpus/PoshCode/Install-ISPackage_1.ps1
Install-ISPackage_1.ps1
####################### <# .SYNOPSIS Installs an SSIS package to a SQL Server store. .DESCRIPTION The Install-ISPackage script installs an Dtsx file to a SQL Server store using the command-line utility dtutil. Works for 2005 and higher .EXAMPLE ./install-ispackage.ps1 -DtsxFullName "C:\\Users\\Public\\bin\\SSIS...
PowerShellCorpus/PoshCode/Issue-PendingRequest.ps1
Issue-PendingRequest.ps1
##################################################################### # Issue certificate.ps1 # Version 1.5 # # Issues certificate request from a pending request # # For this function to succeed, the certificate request must be pending # # Vadims Podans (c) 2010 # http://en-us.sysadmins.lv/ ##################...
PowerShellCorpus/PoshCode/format-iislog for AWStat.ps1
format-iislog for AWStat.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/DriveSpace_1.format.ps1xml.ps1
DriveSpace_1.format.ps1xml.ps1
<?xml version="1.0" encoding="utf-8" ?> <Configuration> <ViewDefinitions> <View> <Name>SpaceGraph</Name> <ViewSelectedBy> <TypeName>System.Management.ManagementObject#root\\cimv2\\Win32_LogicalDisk</TypeName> </ViewSelectedBy> <WideControl> ...
PowerShellCorpus/PoshCode/Get-Gender.ps1
Get-Gender.ps1
function get-gender { param([string]$name) if($name.Length -lt 2) { throw "You need at least two letters in the name" } $name = "$($name[0])".ToUpper() + $name.SubString(1).ToLower() $page = get-web "http://www.babynameaddicts.com/cgi-bin/search.pl?gender=ALL;searchfield=Names;origins=ALL;search...
PowerShellCorpus/PoshCode/Convert-BounceToX_6.ps1
Convert-BounceToX_6.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/Reflection.ps1
Reflection.ps1
#requires -version 2.0 #History: # 1.0 - First public release (March 19, 2010) function Get-Type { <# .Synopsis Gets the types that are currenty loaded in .NET, or gets information about a specific type .Description Gets all of the loaded types, or gets the possible valu...
PowerShellCorpus/PoshCode/LetterDiamondOneliner v_1.ps1
LetterDiamondOneliner v_1.ps1
&{param([char]$c)[int]$s=65;$p=$c-$s;$r=,(' '*$p+[char]$s);$r+=@(do{"{0,$p} {1}{0}"-f([char]++$s),(' '*$f++)}until(!--$p));$r;$r[-2..-99]}Z # trimmed 130 chars w/o arg &{param([char]$c)$p=$c-($s=65);$r=,(' '*$p+[char]$s);do{$r+="{0,$p} {1}{0}"-f([char]++$s),(' '*$f++)}until(!--$p);$r;$r[-2..-99]}J
PowerShellCorpus/PoshCode/Workstation_users Matrix.ps1
Workstation_users Matrix.ps1
#################################################################### # #Script will list all selected workstations and currently logged on user. #Results will be output to a file. A query can be placed on a previous search. #Currently script only works when run directly from a DC #Author: Adam Liquorish #Date: ...