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 Get-Type() { [AppDomain]::CurrentDomain.GetAssemblies() | % { $_.GetTypes() }} | |
function Get-MSDNInfo([Type]$t) { (New-Object –com Shell.Application).Open(“http://msdn.microsoft.com/$(Get-Culture)/library/$($t.FullName).aspx” ) } | |
function Show-ClassInfo([Type]$t) { Get-Member –input (New-Object $t.FullName $args) | Out-Gridview} |
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
# %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\Config\PowerShell\Registration\SharePoint.ps1 | |
# $Host.Runspace.ThreadOptions = "ReuseThread" | |
# Add-PsSnapin Microsoft.SharePoint.PowerShell | |
#DEMO: Get-Command, Get-Member | |
#Display the help for the Get-Command cmdlet | |
help get-command | |
#Get a listing of all the SharePoint cmdlets |
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
# Calling Excel Math Functions From PowerShell | |
$xl = New-Object -ComObject Excel.Application | |
$xlprocess = Get-Process excel | |
$worksheet_function = $xl.WorksheetFunction | |
$data = 1,2,3,4 | |
$matrix = ((1,2,3),(4,5,6),(7,8,10)) | |
Write-Host -ForegroundColor green Median |
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
# Calling Excel Math Functions From PowerShell | |
$xl = New-Object -ComObject Excel.Application | |
$xlprocess = Get-Process excel | |
$wf = $xl.WorksheetFunction | |
$data = 1,2,3,4 | |
$m = ((1,2,3),(4,5,6),(7,8,10)) | |
Write-Host -ForegroundColor green Median |
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 Get-NetworkStatus { | |
$t = [Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}") | |
$networkListManager = [Activator]::CreateInstance($t) | |
$connections = $networkListManager.GetNetworkConnections() | |
function getconnectivity { | |
param($network) | |
switch ($network.GetConnectivity()) { | |
0x0000 { 'disconnected' } | |
{ $_ -band 0x0001 } { 'IPV4_NOTRAFFIC' } | |
{ $_ -band 0x0002 } { 'IPV6_NOTRAFFIC' } |
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 Get-SubDirSizes { | |
param([Parameter(Mandatory=$true)] [string] $path) | |
dir $path -force | | |
? { $_.PSIsContainer} | | |
% { new-object PsObject -property @{ | |
Length = (dir $_.FullName -recurse -force | ? {! $_.PSIsContainer} | measure-object -sum Length).Sum; | |
Name = $_.Name | |
} | |
} | |
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 Format-Columns { | |
################################################################ | |
#.Synopsis | |
# Formats incoming data to columns. | |
#.Description | |
# It works similarly as Format-Wide but it works vertically. Format-Wide outputs | |
# the data row by row, but Format-Columns outputs them column by column. | |
#.Parameter Property | |
# Name of property to get from the object. | |
# It may be |
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
Attribute VB_Name = "Module1" | |
Function RegexMatch(Value As String, Pattern As String, Optional IgnoreCase As Boolean = False) | |
Dim r As New VBScript_RegExp_55.RegExp | |
r.Pattern = Pattern | |
r.IgnoreCase = IgnoreCase | |
RegexMatch = r.Test(Value) | |
End Function | |
Function RegexReplace(Value As String, Pattern As String, ReplaceWith As String, Optional IgnoreCase As Boolean = False) | |
Dim r As New VBScript_RegExp_55.RegExp |
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
param($startstop) | |
if($startstop.ToLower() -eq "stop") | |
{ | |
IISRESET /STOP | |
gsv | ? {$_.DisplayName -like "*share*"} | set-service -StartupType Manual | |
gsv | ? {$_.DisplayName -like "*share*"} | spsv -force | |
gsv | ? {$_.DisplayName -like "*World Wide Web*"} | set-service -StartupType Manual | |
gsv | ? {$_.DisplayName -like "*World Wide Web*"} | spsv |
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
Attribute VB_Name = "Module1" | |
Sub DblVals() | |
Attribute DblVals.VB_ProcData.VB_Invoke_Func = "D\n14" | |
Dim cell As Range | |
For Each cell In Selection | |
If (cell.Value > 0) Then | |
cell.Value = (cell.Value * 2#) | |
End If | |
Next | |
End Sub |