full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/RestartServices.ps1
RestartServices.ps1
param( [string]$alwaysrestartsvrname1 = "Yes", [string]$downloadfolderpath = "", [int]$inactivityinterval = 1) # Service names $srvName1 = "Service1" $srvName2 = "Service2" $srvName3 = "Service3" function RestartServices { # Stop and Start the srvName1 service if it is already running If ($...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/Get-PowerShellRequirements.ps1
Get-PowerShellRequirements.ps1
#Get-PowerShellRequirements.ps1 Param([string[]]$computer = @($env:computername, "LocalHost")) foreach ($c in $computer) { $o = Get-WmiObject win32_operatingsystem -cn $c switch ($o.version) { {$o.version -gt 6.2} {"$c is Windows 8 or greater"; break} {$o.version -gt 6.1} { If($o.ServicePackMajorVersion -gt...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/Audio_Untitled1.ps1
Audio_Untitled1.ps1
Get-ChildItem "*.41000" | foreach { $n = $_.Name.IndexOf(".41000") $str = $_Name.SubString(0, $n) + ".ape" Rename-Item $_.Name $str }
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/WmiExplorer.ps1
WmiExplorer.ps1
# # WmiExplorer.ps1 # # A GUI WMI explorer and WMI Method Help generator # # /\/\o\/\/ 2006 # www.ThePowerShellGuy.com # # load Forms NameSpace [void][System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") [void][reflection.assembly]::LoadWithPartialName("System.Drawing") #region Bu...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/RestartNetwork.ps1
RestartNetwork.ps1
Param ( [Parameter(Mandatory=$true)][int]$sleeptime ) Get-WmiObject win32_networkadapter |Where-Object -Property NetEnabled -EQ 'True' |Format-Table -AutoSize $NetworkDev = Get-WmiObject win32_networkadapter |Where-Object -Property NetEnabled -EQ 'True' Write-Host "BE CAREFULL!" Write-Host ($NetworkDev...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150521/untitled.ps1
untitled.ps1
# Script to import AdventSTS.pfx and AdventDirectST.pfx keys # into local key stores so they can be used by Advent software. # # Author: Bevan Kling, Richard Mills # param ( [String] $AdventATCPfx = $(throw "Please supply a AdventStsPfx file name"), [string] $ATCPassword = $(throw "Please supply a S...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150521/2untitled.ps1
2untitled.ps1
######################################## # Webdav Upload with Powershell ######################################## # Absolute path to file #$file="D:\text.txt" $file = $Result.Path; # URL no trailing "/" $url = "https://webdav.synapse.com/Disney/beakerdata" # Username and Password $user = "" $pass = "" ...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150521/1untitled.ps1
1untitled.ps1
# Script to import AdventSTS.pfx and AdventDirectST.pfx keys # into local key stores so they can be used by Advent software. # # Author: Bevan Kling, Richard Mills # Updated: 2015-05-14 Tim Liu param ( [String] $AcdApiPfx = $(throw "Please supply a AdventStsPfx file name"), [string] $AcdApiPassword ...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150720/Rename.ps1
Rename.ps1
param ( [Parameter(Mandatory = $true)] [int]$sInput = $(throw "Please supply a date with yyyyMMdd") ) #Get-ChildItem | ForEach-Object -Process { Rename-Item $_.FullName($_.Name.Split("_")[0] + "_" + $sInput + $_.Name.Split("_")[1].Substring(8)) } #Get-ChildItem | ForEach-Object -Process { $_.LastWritetim...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150730/ExtractZip.ps1
ExtractZip.ps1
How to Extract ZIP Files Using PowerShell We have seen this question asked numerous times on Stack Overflow and forums alike but most of the time people recommend using the PowerShell Community Extensions or a legacy command line application. Truth be told, its not actually all that hard to do in PowerShell. $she...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150518/Untitled1.ps1
Untitled1.ps1
param ( [Parameter(Mandatory=$true)][string]$shareLocation, [Parameter(Mandatory=$true)][string]$firmID, [Parameter(Mandatory=$true)][int]$workflowInstanceId ) Write-Host "Begin conversion script $scriptName." Try { # Import functions to the current session. $scriptPath = split-path -par...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150518/getDomainByMachineName.ps1
getDomainByMachineName.ps1
# $computer = $env:COMPUTERNAME # $namespace = "ROOT\CIMV2" # $classname = "Win32_OperatingSystem" # Write-Output "=====================================" # Write-Output "COMPUTER : $computer " # Write-Output "CLASS : $classname " # Write-Output "=====================================" # Get-WmiObject -Clas...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/PS1_temp/wmiobject.ps1
wmiobject.ps1
Write-Host "---------------华丽的分割线------------------" function OTR () { $ts = Get-WmiObject Win32_TerminalServiceSetting -Namespace ROOT\CIMV2\TerminalServices $r = $ts.AllowTSConnections if ($r -eq 1) { Write-Host "远程桌面处于开启状态,无需重复开启" } else { $ts.SetAllowTSConnections(1) | Out-Null Write-...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/PS1_temp/freespace.ps1
freespace.ps1
<# #> param ( [Parameter(Mandatory = $false)] [string]$hostname = $env:COMPUTERNAME #[bool]$Not ) #Enable-PSRemoting #Set-ExecutionPolicy RemoteSigned # Main code here Get-CimInstance -ComputerName $hostname -ClassName Win32_LogicalDisk -Filter "DeviceId='c:'" | Select-Object ` @{ n =...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150423/Untitled4.ps1
Untitled4.ps1
Get-WmiObject -Class $classname -ComputerName $computer -Namespace $namespace | Select-Object * -ExcludeProperty PSComputerName, Scope, Path, Options, ClassPath, Properties, SystemProperties, Qualifiers, Site, Container | Format-List -Property [a-z]*
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150423/test.ps1
test.ps1
$ieVersion = New-Object -TypeName System.Version -ArgumentList ( Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Internet Explorer').Version $ieVersion = New-Object -TypeName System.Version -ArgumentList ( # switch major and minor $ieVersion.Minor, $ieVersion.Major, $ieVersion.Build, $ieVersion.Revision) if...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150423/Untitled1.ps1
Untitled1.ps1
#PARAM([STRING]$COMPUTER = $ENV:COMPUTERNAME) param([string]$COMPUTER = $ENV:COMPUTERNAME) $HKLM = 2147483650 $KEY = "SOFTWARE\MICROSOFT\INTERNET EXPLORER" $VALUE = "VERSION" $WMI = [wmiclass]"\\$COMPUTER\ROOT\DEFAULT:STDREGPROV" #($WMI.GetStringValue($HKLM,$KEY,$VALUE)).sValue #($WMI.GetStringValue($HKLM,$KEY,$...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150423/Untitled2.ps1
Untitled2.ps1
#param([Parameter(Mandatory = $TRUE)][Alias("COMPUTER")] $COMPUTERNAME) $env:COMPUTERNAME #$env:COMPUTERNAME $REGISTRY = [MICROSOFT.WIN32.REGISTRYKEY]::OPENREMOTEBASEKEY('LOCALMACHINE',$COMPUTERNAME) $REGISTRYKEY = $REGISTRY.OPENSUBKEY("SOFTWARE\\MICROSOFT\\INTERNET EXPLORER") $VALUE = $REGISTRYKEY.GETVALUE("...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150423/Untitled3.ps1
Untitled3.ps1
$computer = $env:COMPUTERNAME $namespace = "ROOT\DEFAULT" $classname = "StdRegProv" $HKLM = 2147483650 $KEY = "SOFTWARE\MICROSOFT\INTERNET EXPLORER" $VALUE = "VERSION" #$WMI = [wmiclass]"\\$COMPUTER\ROOT\DEFAULT:STDREGPROV" #($WMI.GetStringValue($HKLM,$KEY,$VALUE)).sValue #($WMI.GetStringValue($HKLM,$KEY,$VAL...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/getHostnamewithdomain.ps1
getHostnamewithdomain.ps1
$computer $localpcname = [System.Net.Dns]::GetHostByName("localhost").Hostname "\\"$localpcname"\C$\Users\tliu\Downloads\AdventDirectAgentSetup_Firm5005_15_05_0_461.exe" ([WMICLASS]"\\$computer\ROOT\CIMV2:Win32_Process").Create($InstallString) | Out-File -FilePath c:\installed.txt -Append -InputObject "$computer"
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/importcert.ps1
importcert.ps1
# Script to import AdventSTS.pfx and AdventDirectST.pfx keys # into local key stores so they can be used by Advent software. # # Author: Bevan Kling, Richard Mills # Updated: 2015-05-14 Tim Liu param ( [String] $AcdApiPfx = $(throw "Please supply a AdventStsPfx file path"), [string] $AcdApiPassword ...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/Enable_PS_Remotly.ps1
Enable_PS_Remotly.ps1
param ( [string]$pcName = "pcName", [string]$loginUser = "administrator", [string]$loginPassword = "loginPwd" ) $authCmd = "PsExec \\" + $pcName + " -u " + $loginUser + " -p " + $loginPassword + " PowerShell " $authCmd + "Enable-PSRemoting -Force" $authCmd + "Get-Item WSMan:\localhost\Client\TrustedHo...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/Unzip_DotNetZip.ps1
Unzip_DotNetZip.ps1
function unzip ($zipFilePath, $targetDir) { # load Ionic.Zip.dll [System.Reflection.Assembly]::LoadFrom(d:\Ionic.Zip.dll) $encoding = [System.Text.Encoding]::GetEncoding("utf-8") $zipfile = new-object Ionic.Zip.ZipFile($encoding) if (!(test-path (split-path $targetDir -parent))) { mkdir (split-...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/Get-MD5.ps1
Get-MD5.ps1
Function Get-MD5HashCode { Param( $Path ) $MD5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider $Hash = [System.BitConverter]::ToString($MD5.ComputeHash([System.IO.File]::ReadAllBytes($Path))) $Hash } Get-MD5HashCode("C:\Temp\1command_Lines_snippets.tx...
PowerShellCorpus/Github/niuniuliu_PowerShell_PS/20150506/DotNetZip.ps1
DotNetZip.ps1
## - Beginning of Script: Function New-ZipFile{ PARAM ( [String] $SrcFolder, [String] $DestFolder, [string] $DestZipName, [String] $FileExtToZip, [string] $ZipPurpose, [string] $StoredInZipFolder, [string] $DeleteFiles = $null ) #$TodaysDate = Get-Date -uformat "%Y-%m-%d-%Hh%Mm%Ss.zip"; #$ZipFileName = $Zi...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator.UI.Winforms/_CreateNewNuGetPackage/Config.ps1
Config.ps1
#========================================================== # Edit the variable values below to configure how your .nupkg file is packed (i.e. created) and pushed (i.e. uploaded) to the NuGet gallery. # # If you have modified this script: # - if you uninstall the "Create New NuGet Package From Project After Each Bu...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator.UI.Winforms/_CreateNewNuGetPackage/DoNotModify/UploadNuGetPackage.ps1
UploadNuGetPackage.ps1
#========================================================== # DO NOT EDIT THIS FILE. # If you want to configure how your package is uploaded, modify the Config.ps1 file. # To run this script from inside Visual Studio, right-click on the "RunMeToUploadNuGetPackage.cmd" file and choose "Run". #=======================...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator.UI.Winforms/_CreateNewNuGetPackage/DoNotModify/New-NuGetPackage.ps1
New-NuGetPackage.ps1
#Requires -Version 2.0 <# .SYNOPSIS Creates a NuGet Package (.nupkg) file from the given Project or NuSpec file, and optionally uploads it to a NuGet Gallery. .DESCRIPTION Creates a NuGet Package (.nupkg) file from the given Project or NuSpec file. Additional parameters may be provided to also upload the ...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator.UI.Winforms/_CreateNewNuGetPackage/DoNotModify/CreateNuGetPackage.ps1
CreateNuGetPackage.ps1
#========================================================== # DO NOT EDIT THIS FILE. # If you want to configure how your package is created, modify the Config.ps1 file. # # This script is ran automatically after every successful build. # This script creates a NuGet package for the current project, and places the ....
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator/_CreateNewNuGetPackage/Config.ps1
Config.ps1
#========================================================== # Edit the variable values below to configure how your .nupkg file is packed (i.e. created) and pushed (i.e. uploaded) to the NuGet gallery. # # If you have modified this script: # - if you uninstall the "Create New NuGet Package From Project After Each Bu...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator/_CreateNewNuGetPackage/DoNotModify/UploadNuGetPackage.ps1
UploadNuGetPackage.ps1
#========================================================== # DO NOT EDIT THIS FILE. # If you want to configure how your package is uploaded, modify the Config.ps1 file. # To run this script from inside Visual Studio, right-click on the "RunMeToUploadNuGetPackage.cmd" file and choose "Run". #=======================...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator/_CreateNewNuGetPackage/DoNotModify/New-NuGetPackage.ps1
New-NuGetPackage.ps1
#Requires -Version 2.0 <# .SYNOPSIS Creates a NuGet Package (.nupkg) file from the given Project or NuSpec file, and optionally uploads it to a NuGet Gallery. .DESCRIPTION Creates a NuGet Package (.nupkg) file from the given Project or NuSpec file. Additional parameters may be provided to also upload the ...
PowerShellCorpus/Github/BrandonLegault_ExpressionEvaluator/BrandoSoft.CSharp.Evaluator/_CreateNewNuGetPackage/DoNotModify/CreateNuGetPackage.ps1
CreateNuGetPackage.ps1
#========================================================== # DO NOT EDIT THIS FILE. # If you want to configure how your package is created, modify the Config.ps1 file. # # This script is ran automatically after every successful build. # This script creates a NuGet package for the current project, and places the ....
PowerShellCorpus/Github/jmcnatt_PowerShell/New-Script.ps1
New-Script.ps1
<# .SYNOPSIS Generates a new powershell script. .DESCRIPTION This script can be used to create new scripts via a template. The template is built into the script and can be editted as needed. .PARAMETER Name The file name of the script to be created. .PARAMETER location ...
PowerShellCorpus/Github/jmcnatt_PowerShell/Remove-Packages.ps1
Remove-Packages.ps1
<# .SYNOPSIS .DESCRIPTION .PARAMETER .EXAMPLE #> [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [String] $Name, [Parameter(Position = 1, Mandatory = $false)] [Switch] $C...
PowerShellCorpus/Github/jmcnatt_PowerShell/Install-Drivers.ps1
Install-Drivers.ps1
<# .SYNOPSIS Installs drivers in the current directory with pnputil .DESCRIPTION Interates the current directories and subdirectories and installs drivers with pnputil. Looks for .inf files and their supporting binaries. pnputil force installs the driver but may need additional input for...
PowerShellCorpus/Github/red-gate_build-script-template/.build/_init.ps1
_init.ps1
#Requires -Version 4.0 $ErrorActionPreference = 'Stop' # Ignoring progress stream is vital to keep the performance # of Invoke-WebRequest decent in Teamcity $ProgressPreference = 'SilentlyContinue' function global:RestoreBuildLevelPackages { # Download paket.exe. # Use --prefer-nuget to get it from n...
PowerShellCorpus/Github/red-gate_build-script-template/.build/installer.tasks.ps1
installer.tasks.ps1
# Contains tasks we use to build our installers [CmdletBinding()] param() <# .SYNOPSIS Turn the mini installer .exe into a nuget package for consumption in the CFU bundles .EXAMPLE New-MiniInstallerPackage -BranchName foo -ProductName "SQL Compare" -Version 1.0.0.0 -IsDefaultBranch $false -PathToMiniInstal...
PowerShellCorpus/Github/red-gate_build-script-template/.build/build.ps1
build.ps1
[CmdletBinding()] param( [string] $Configuration = 'Release', [string] $BranchName = 'dev', [bool] $IsDefaultBranch = $false, [string] $NugetFeedUrl, [string] $NugetFeedApiKey, [string] $SigningServiceUrl, [string] $GithubAPIToken ) $RootDir = "$PsScriptRoot\.." | Resolve-Path $...
PowerShellCorpus/Github/afzalulhb_TBS/TBS/packages/EntityFramework.6.1.3/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package, $project) if (Get-Module | ?{ $_.Name -eq 'EntityFramework' }) { Remove-Module EntityFramework } Import-Module (Join-Path $toolsPath EntityFramework.psd1) # SIG # Begin signature block # MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQ...
PowerShellCorpus/Github/afzalulhb_TBS/TBS/packages/EntityFramework.6.1.3/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) Initialize-EFConfiguration $project Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' Write-Host Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma...
PowerShellCorpus/Github/cybtron_RealEstateManagement/RealEstateManagement/packages/EntityFramework.5.0.0/tools/init.ps1
init.ps1
param($installPath, $toolsPath, $package, $project) $importedModule = Get-Module | ?{ $_.Name -eq 'EntityFramework' } if ($PSVersionTable.PSVersion -ge (New-Object Version @( 3, 0 ))) { $thisModuleManifest = 'EntityFramework.PS3.psd1' } else { $thisModuleManifest = 'EntityFramework.psd1' } $thisModule...
PowerShellCorpus/Github/cybtron_RealEstateManagement/RealEstateManagement/packages/EntityFramework.5.0.0/tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) function Invoke-ConnectionFactoryConfigurator($assemblyPath, $project) { $appDomain = [AppDomain]::CreateDomain( 'EntityFramework.PowerShell', $null, (New-Object System.AppDomainSetup -Property @{ ShadowCopyFiles = 'true' })) ...
PowerShellCorpus/Github/cybtron_RealEstateManagement/RealEstateManagement/packages/jQuery.1.7.1.1/Tools/uninstall.ps1
uninstall.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # Determine the file paths $projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName $origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName if (Test-Path $projectIntelliSense...
PowerShellCorpus/Github/cybtron_RealEstateManagement/RealEstateManagement/packages/jQuery.1.7.1.1/Tools/install.ps1
install.ps1
param($installPath, $toolsPath, $package, $project) . (Join-Path $toolsPath common.ps1) # VS 11 and above supports the new intellisense JS files $supportsJsIntelliSenseFile = [System.Version]::Parse($dte.Version).Major -ge 11 if (-not $supportsJsIntelliSenseFile) { Write-Host "IntelliSense JS files are n...
PowerShellCorpus/Github/cybtron_RealEstateManagement/RealEstateManagement/packages/jQuery.1.7.1.1/Tools/common.ps1
common.ps1
function Get-Checksum($file) { $cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider" $fileInfo = Get-Item $file trap { ; continue } $stream = $fileInfo.OpenRead() if ($? -eq $false) { # Couldn't open file for reading return $null } $bytes = $...
PowerShellCorpus/Github/Alex-Yates_Powershell-for-Oracle-Database-CI-with-Bamboo/DeployTask2-DeployToTarget.ps1
DeployTask2-DeployToTarget.ps1
# Configuration $schemaComparePath = 'C:\\Program Files\\Red Gate\\Schema Compare for Oracle 3\\SCO.exe' $targetSchemaName = "${bamboo.OracleDbLiveSchema}" $schemaRelativePath = "${bamboo.schemaRelativePath}" $tns = "${bamboo.OracleTns}" $username = "${bamboo.OracleDbUser}" $password = "${bamboo.OracleDbPassword}...
PowerShellCorpus/Github/Alex-Yates_Powershell-for-Oracle-Database-CI-with-Bamboo/BuildTask1-SyncToIntegrationDb.ps1
BuildTask1-SyncToIntegrationDb.ps1
# Configuration $schemaComparePath = 'C:\\Program Files\\Red Gate\\Schema Compare for Oracle 3\\SCO.exe' $schemaRelativePath = "${bamboo.schemaRelativePath}" $targetSchemaName = "${bamboo.OracleDbIntegrationSchema}" $tns = "${bamboo.OracleTns}" $username = "${bamboo.OracleDbUser}" $password = "${bamboo.OracleDbPa...
PowerShellCorpus/Github/Alex-Yates_Powershell-for-Oracle-Database-CI-with-Bamboo/DeployTask1-ExtractNuGetPkg.ps1
DeployTask1-ExtractNuGetPkg.ps1
$nuget = '${bamboo.build.working.directory}\widget.0.${bamboo.buildNumber}.nupkg' $destination = '${bamboo.build.working.directory}\extractedNuGet' # Clean the destination directory. If (Test-Path $destination) { rmdir $destination -Recurse -Force } # Extract the NuGet package # Code copied from http://s...
PowerShellCorpus/Github/lerwine_PSSecureTransfer/PSSecureTransfer/Install.ps1
Install.ps1
$Script:ModuleName = 'PSSecureTransfer'; Function Read-YesOrNo { Param( [string]$Caption, [string]$Message, [bool]$DefaultValue ) $choices = New-Object -TypeName:'System.Collections.ObjectModel.Collection`1[System.Management.Automation.Host.ChoiceDescription]'; $choices.Ad...
PowerShellCorpus/Github/lerwine_PSSecureTransfer/PSSecureTransfer/Module.test.ps1
Module.test.ps1
if ((Get-Module -Name:'PSSecureTransfer') -ne $null) { Remove-Module -Name:'PSSecureTransfer' } Import-Module -Name:'PSSecureTransfer'; $TempKeyName = [Guid]::NewGuid().ToString('N'); $KeyExportPath = [System.IO.Path]::GetTempPath() | Join-Path -ChildPath:$TempKeyName; Export-PublicKey -Path:$KeyExportPath; Im...
PowerShellCorpus/Github/itadder_Clean-PC/Set-CleanPC.ps1
Set-CleanPC.ps1
# Create Function Skelton function Set-ITCleanPC{ [cmdletBinding()] param( [Parameter(Mandatory=$True, # Required to use a Parameter ValueFromPipeline=$True, # Allow Value from | Pipeline ValueFromPipelineByPropertyName=$True)] # Allow a Object to attach it properties to the computername Parameter [Al...
PowerShellCorpus/Github/itadder_Clean-PC/Script.ps1
Script.ps1
# # Script.ps1 #
PowerShellCorpus/Github/Antony74_EPubShrink/EPubShrink.ps1
EPubShrink.ps1
#*********************************************************************# #*** This software is in the public domain, furnished "as is", ***# #*** without technical support, and with no warranty, express ***# #*** or implied, as to its usefulness for any purpose. ***# #***************************...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsClient-LeaveDomain7.ps1
WindowsClient-LeaveDomain7.ps1
# ========================================================================================= # Dynamic Variables # ========================================================================================= $DomainUser = "$DomainUsername@$Domain" $DomainPass = $DomainPassword | ConvertTo-SecureString -asPlainText -Fo...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-InstallADCS.ps1
WindowsServer-InstallADCS.ps1
<# Windows Server - Deploy Subordinate CA This works in either an existing domain, or a standlone CA. $CertificateValidPeriod Length of the CA Validaty Period $CAType Certificate Authority Type. root or subordinate Special Thanks to: http://security-24-7.com/windows-2012-r2-certification-au...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-ConfigureSubordinateCA.ps1
WindowsServer-ConfigureSubordinateCA.ps1
<# #> Write-Output '== Setting up Fileshare ================' net use \\itsnas01.main.ad.rit.edu\vRAscripts$\Components\ /user:vrauser Student1! Write-Output '== Copying certsrv =====================' & \\itsnas01.main.ad.rit.edu\vRAscripts$\Components\certsrv\certsrv_dist.exe -o"C:\certsrv" $CAType = "Stan...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsClient-JoinDomain7.ps1
WindowsClient-JoinDomain7.ps1
# ========================================================================================= # Dynamic Variables # ========================================================================================= $DomainUser = "$DomainUsername@$Domain" $DomainPass = $DomainPassword | ConvertTo-SecureString -asPlainText -Fo...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-DeployDNS.ps1
WindowsServer-DeployDNS.ps1
<# Required Variables: - $ZoneTemplate vsphere.%VRMOwner%.lab #> # ========================================================================================= # Dynamic Variables # ========================================================================================= # Read in VRM Data [xml]$VM...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-DeploySubordinateCA.ps1
WindowsServer-DeploySubordinateCA.ps1
<# Windows Server - Deploy Subordinate CA This works in either an existing domain, or a standlone CA. #> Install-WindowsFeature AD-Certificate, ADCS-Online-Cert -IncludeManagementTools # Server needs to be rebooted
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-DeployADDomain.ps1
WindowsServer-DeployADDomain.ps1
<# Required Variables: - $ZoneTemplate vsphere.%VRMOwner%.lab #> # ========================================================================================= # Dynamic Variables # ========================================================================================= $SafeModePassword = "Student1!...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-DeployDHCP.ps1
WindowsServer-DeployDHCP.ps1
<# DHCPNIC #> # ========================================================================================= # Functions # ========================================================================================= # Src: http://www.indented.co.uk/2010/01/23/powershell-subnet-math/ function ConvertTo-DottedDeci...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-EnableWinRM.ps1
WindowsServer-EnableWinRM.ps1
<# Enable WinRM $Hostname #> $Cert = New-SelfSignedCertificate -DnsName ns.dot.lab -CertStoreLocation Cert:\LocalMachine\My # Works under CMD winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname=”' + $Hostname + '”; CertificateThumbprint=”' + $Cert.Thumbprint + '”}' netsh ...
PowerShellCorpus/Github/volfco_rit-vra-scripts/WindowsServer-JoinDomain.ps1
WindowsServer-JoinDomain.ps1
# ========================================================================================= # Dynamic Variables # ========================================================================================= $DomainUsername = "$Username@$Domain" $DomainPassword = "$Password" | ConvertTo-SecureString -asPlainText -Force...
PowerShellCorpus/Github/volfco_rit-vra-scripts/Hyper-V/Install Hyper-V.ps1
Install Hyper-V.ps1
# ========================================================================================= # Dynamic Variables # ========================================================================================= $DomainUsername = "Administrator@hyper-v" $DomainPassword = "Student1!" | ConvertTo-SecureString -asPlainText -F...
PowerShellCorpus/Github/volfco_rit-vra-scripts/Hyper-V/Configure Hyper-V Manager.ps1
Configure Hyper-V Manager.ps1
<# $Hosts List of Hyper-V Hostnames $ManagementIPNetmask IP Address of the Management Network $ManagementIPAddress #> # ========================================================================================= # Functions # ===========================================================...
PowerShellCorpus/Github/volfco_rit-vra-scripts/Exchange/Microsoft Exchange - Setup Server.ps1
Microsoft Exchange - Setup Server.ps1
$SourcePath = "\\itsnas01.main.ad.rit.edu\vRAscripts$\Blueprints\Exchange" # Mount Fileshare Write-Output '== Setting up Fileshare ================' net use $SourcePath /user:vrauser Student1! # Build Credential Object to allow us to run the below program as the Domain Admin $Domain = ( Get-ADDomain ).Name $c...
PowerShellCorpus/Github/volfco_rit-vra-scripts/Exchange/Microsoft Exchange - Add Mailbox.ps1
Microsoft Exchange - Add Mailbox.ps1
PowerShellCorpus/Github/volfco_rit-vra-scripts/Infastructure/ns.dot.lab/Cleanup Records.ps1
Cleanup Records.ps1
Write-Output '== Setup ==============================' Write-Output ' Hello...' Import-Module VMware.VimAutomation.Core Write-Output " It's Me..." # Connect to the vCenter server we just made Write-Output '== Connecting to vCenter ==============' Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -S...
PowerShellCorpus/Github/volfco_rit-vra-scripts/VMware/vSphere-ConfigureNetworking.ps1
vSphere-ConfigureNetworking.ps1
# ========================================================================================= # Preflight Checks # ========================================================================================= # Attempt to read in the Summary.xml $Summary = [System.Xml.XmlDocument](Get-Content 'C:\Summary-vCenter.xml');...
PowerShellCorpus/Github/volfco_rit-vra-scripts/VMware/vSphere-ConfigureEnvironment.ps1
vSphere-ConfigureEnvironment.ps1
# ========================================================================================= # Preflight Checks # ========================================================================================= # Attempt to read in the Summary.xml $Summary = [System.Xml.XmlDocument](Get-Content 'C:\Summary-vCenter.xml');...
PowerShellCorpus/Github/volfco_rit-vra-scripts/VMware/vSphere-Install55u2.ps1
vSphere-Install55u2.ps1
PowerShellCorpus/Github/volfco_rit-vra-scripts/VMware/vSphere-SetupEnvironment.ps1
vSphere-SetupEnvironment.ps1
<# Copyright 2017 Rochester Institute of Technology Colum McGaley <cxm7688@rit.edu> This product, and all resources contained herein, are provided for reference, and non-commercial uses only. Modifications are permitted for Personal and Educational use only, as long as they are distributed for the same purpose...
PowerShellCorpus/Github/meterien_ConfigMgr/Increment-CMDeploymentDeadline.ps1
Increment-CMDeploymentDeadline.ps1
#------ # Originale source # Benedikt Winder : http://www.bewi.at/?p=1155 # Russ Slaten : http://blogs.msdn.com/b/rslaten/archive/2013/11/26/past-due-applications-not-installing-in-sccm-2012.aspx #------ # Modifié par : Josua Baril-Aumond # Date création : 2015-09-01 # Date modification : 2015-...
PowerShellCorpus/Github/meterien_ConfigMgr/Set-FolderPermission.ps1
Set-FolderPermission.ps1
param( [Parameter(Mandatory=$true)] [String]$folder, [Parameter(Mandatory=$true)] [String]$user, [Parameter(Mandatory=$true)] [String]$permission, [Parameter(Mandatory=$true)] [ValidateSet("Allow", "Denied")] [String]$type = "Allow", [Parameter(Mandatory=$true)] [S...
PowerShellCorpus/Github/meterien_ConfigMgr/Remove-RegistryMSIReferences.ps1
Remove-RegistryMSIReferences.ps1
param( $softwareName, $whatIf = $true ) $null = New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT $RegUninstallPaths = @( 'HKCR:\HKCR:\Installer', 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\U...
PowerShellCorpus/Github/meterien_ConfigMgr/iPXE/Create-iPXECMImage.ps1
Create-iPXECMImage.ps1
# Must have the script "Extract-ISOContent.ps1" in the current directory # Must have the ConfigMgr console installed locally # Must have ADK 8.1 installed locally # Must have powershell v5 Param( [String]$p_server = "myserver", [String]$p_siteCode = "001", [String]$p_imageId = "SMS000088", [St...
PowerShellCorpus/Github/meterien_ConfigMgr/iPXE/Extract-ISOContent.ps1
Extract-ISOContent.ps1
# Thanks to # http://codebroth.com/extracting-iso-images-with-powershell/ => Jaume Sancho param( [string]$isoPath = "C:\Personnel\my.iso", [string]$destination = "C:\Personnel\Extracted", [string]$overwrite = $false) # Get current location $location = Get-Location # Extract the content #...
PowerShellCorpus/Github/meterien_ConfigMgr/WinSAT/Run-WinSat.ps1
Run-WinSat.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, Position=0)] [String]$Version = '' ) Start-Process -FilePath "C:\Windows\system32\WinSAT.exe" -ArgumentList "formal -restart" -Wait -NoNewWindow $fichier = Get-Chi...
PowerShellCorpus/Github/meterien_ConfigMgr/WinSAT/RunHidden.ps1
RunHidden.ps1
Start-Process -FilePath "$env:windir\system32\WinSAT.exe" -ArgumentList "formal" -WindowStyle Hidden
PowerShellCorpus/Github/meterien_ConfigMgr/WinSAT/Run-WinSatRegistry.ps1
Run-WinSatRegistry.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, Position=0)] [String]$Version = '' ) [string]$scriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent $fichier = Get-ChildItem -Path $env:S...
PowerShellCorpus/Github/meterien_ConfigMgr/WinSAT/RunWinSat.ps1
RunWinSat.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, Position=0)] [String]$Version = '' ) $scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path; Start-Process -FilePath "$scriptDirectory\ServiceUIx86.exe...
PowerShellCorpus/Github/meterien_ConfigMgr/Driver/Extract-HPDriver.ps1
Extract-HPDriver.ps1
# Script installation : Extraction de pilote HP # Description : Prend en charge seulement les executables param( [String]$source, [String]$destination, [String]$model = "ExtractContent" ) $CurrentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path; # Create sub-folder to extract content ...
PowerShellCorpus/Github/meterien_ConfigMgr/EndpointProtection/Get-SCEPDefinitions.ps1
Get-SCEPDefinitions.ps1
<# .SYNOPSIS Download SCEP definitions from Microsoft website and save them in a folder. .PARAMETER destinationFolder This folder must contain 2 extras folder named x86 and x64 or they will be created. a single computer name or an array of computer names. You mayalso provide IP a...
PowerShellCorpus/Github/meterien_ConfigMgr/MCastMonitor/Monitor-CMMCastSession.ps1
Monitor-CMMCastSession.ps1
Param( [String]$logLocation = "$env:SystemRoot\Logs\Software", [String]$logName = "$logLocation\MCast-Monitoring.Log" ) # Definition des fonctions Function Log-ScriptEvent { [CmdletBinding()] Param( # Chemin du journal [parameter(Mandatory=$True)] [String]$NewLog, ...
PowerShellCorpus/Github/meterien_ConfigMgr/BuildnCapture/Dism-ModifyConfigMgrImage.ps1
Dism-ModifyConfigMgrImage.ps1
param( [parameter(Mandatory=$True)] [String]$wimFile, [parameter(Mandatory=$True)] $mountPoint, [parameter(Mandatory=$True)] [Validateset('ADK8.1', 'ADK10')] $dismVersion, $ccmappsFolder = "C:\Windows\ccmapps", $appsToCopy = @() ) function prereq { $i = 0 if(-...
PowerShellCorpus/Github/meterien_ConfigMgr/BuildnCapture/Check-CMImageReadyForCapture.ps1
Check-CMImageReadyForCapture.ps1
# Permet de passer des parametres et d'accepter les parametres de bases ex: -Verbose [CmdletBinding()] param( ) # Definitions des fonctions ---------------------------------------- Function Log-ScriptEvent { #Define and validate parameters [CmdletBinding()] Param( #Path to the log fil...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/Test-RenameComputer.ps1
Test-RenameComputer.ps1
$ar = New-Object System.Collections.Generic.List[System.Object] $computersList = Get-ADComputer -Filter * foreach($pc in $computersList) { $display = New-Object System.Object $oldName = $pc.Name $display | Add-Member -type NoteProperty -name Debut -value $oldName $newName = "" $newName = $ol...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/Test-ChangeADUser.ps1
Test-ChangeADUser.ps1
# Must have ActiveDirectory and ImportExcel module available Import-Module ActiveDirectory Import-Module .\ImportExcel $ar = New-Object System.Collections.Generic.List[System.Object] $displayList = @() $searchOU = "" $usersList = Get-ADUser -searchbase $searchOU -searchscope 1 -Filter * -Properties givenN...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/Move-ADComputer.ps1
Move-ADComputer.ps1
<# .SYNOPSIS Move a computer in Active Directory based on task sequence variables (OSDDomainOUName) or the organisationnal unit in parameter. .PARAMETER newOU The destination organisationnal unit .PARAMETER computerName The computer name to move .PARAMETER fichier The file that contain an e...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/ConfigMgr-ADMaintenance.ps1
ConfigMgr-ADMaintenance.ps1
# ----- # Author : Josua Baril-Aumond # Creation date : 2015-06-26 # Modification : 2016-05-06 # Version : 0.1.1 # Description : FR => Cet outil va permettre de concilier l'inventaire Active Directory et celui de ConfigMgr 2012. Les ordinateurs sont enlevés du groupe # ...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/Rename-Computer.ps1
Rename-Computer.ps1
param( [String]$Fichier = ".\password.bin", [String]$Key = ".\key.bin", [String]$username ) function Store-SecureSrtringFrom-Text([String]$m_Fichier) { # Capture once and store to file $passwd = Read-Host "Enter password" -AsSecureString $encpwd = ConvertFrom-SecureString $passwd ...
PowerShellCorpus/Github/meterien_ConfigMgr/ActiveDirectory/Set-ADComputerDescription.ps1
Set-ADComputerDescription.ps1
param( [String]$computerName = $env:COMPUTERNAME, [String]$newDescription = "", [String]$userName = "", [String]$passwordFile = ".\password.bin", [String]$Key = ".\key.bin" ) function Store-SecureSrtringFrom-Text([String]$m_file) { # Capture once and store to file $passwd = Read-...
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-AjouterOptionChangerUtilisateur.ps1
Set-AjouterOptionChangerUtilisateur.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" $name = "HideFastUserSwitching" $val = "0" $type = "DWORD" New-ItemProperty $regKey -Name $name -Value $val -PropertyType $type -Force
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-IntelPME.ps1
Get-IntelPME.ps1
# This function tests if a registry value exists, returning True if the value exists function Test-RegistryValue ([string] $key, [string] $name) { Get-ItemProperty -Path "$key" -Name "$name" -ErrorAction SilentlyContinue | Out-Null; return $?; } $NICRegPathRoot = "HKLM:SYSTEM\CurrentControlSet\Cont...
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-RaccourciRedemarrer.ps1
Get-RaccourciRedemarrer.ps1
$racc = Get-ChildItem "$env:PUBLIC\Desktop" | Where-Object -Property "Name" -EQ "Redémarrer.lnk" if($racc.Length -gt 0) { return 'Compliant' } else { return 'NonCompliant' }
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-ComplianceJava.ps1
Set-ComplianceJava.ps1
# === Josua Baril-Aumond === # Modification : 2015-06-05 # Script installation : Configuration de Java # Description : ajoute exception pour les vieux et desuets sites java # Definition des variables $ErrorActionPreference = "SilentlyContinue" $CurrentLocation = Split-Path -Parent $MyInvocation.MyCommand.Path; ...
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-ComplianceJava.ps1
Get-ComplianceJava.ps1
# === Josua Baril-Aumond === # Modification : 2015-06-05 # Script installation : Detection de la bonne configuration de Java pour desactiver les mises a jour # Version check : 1 # Definition des variables $ErrorActionPreference = "SilentlyContinue" $CurrentLocation = Split-Path -Parent $MyInvocation.MyCommand.P...
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Get-ComplianceCacheSCCM.ps1
Get-ComplianceCacheSCCM.ps1
$ErrorActionPreference = "SilentlyContinue" $size = 10240 $CCM = New-Object -com UIResource.UIResourceMGR ($ccm.GetCacheInfo()).totalsize
PowerShellCorpus/Github/meterien_ConfigMgr/Compliance/Set-IE10EndOfLlifeNotification.ps1
Set-IE10EndOfLlifeNotification.ps1
$regKey = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_IE11_SECURITY_EOL_NOTIFICATION" $regKey32bits = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_IE11_SECURITY_EOL_NOTIFICATION" $name = "iexplore.exe" $val = "00000001" $type = "DWOR...