full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/CreateGroup.ps1 | CreateGroup.ps1 | $intGroupType = 2
$strClass = "Group"
$strOUName = "CN=MyTestGroup"
$objADSI = [ADSI]"LDAP://OU=MyTestOU,DC=Montel,DC=local"
$objGroup = $objADSI.Create($strClass, $strOUName)
$objGroup.put("GroupType", $intGroupType)
$objGroup.setInfo()
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/ModifyUserProfile.ps1 | ModifyUserProfile.ps1 | $objUser = [ADSI]"LDAP://CN=MyTestUser,OU=MyTestOU,DC=Montel,DC=local"
$objUser.Put("profilePath", "\\London\Profiles\MyTestUser")
$objUser.Put("scriptPath", "logon.vbs")
$objUser.Put("homeDirectory", "\\London\Users\MyTestUser") #City
$objUser.Put("homeDrive", "H:")
$objUser.SetInfo()
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/DeleteUser.ps1 | DeleteUser.ps1 | $strClass = "User"
$strName = "CN=MyUser"
$objADSI =[ADSI]"LDAP://OU=MyTestOU,DC=Montel,DC=local"
$ocjUser = $objADSI.Delete($strClass, $strName)
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/ModifyOrganizationalPage.ps1 | ModifyOrganizationalPage.ps1 |
$strDomain = "DC=Montel,DC=local"
$strOU = "OU=MyTestOU"
$strUser = "CN=MyTestUser"
$strManager = "CN=MyBoss"
$objUser = [ADSI]"LDAP://$strUser,$strOU,$strDomain"
$objUser.Put("title", "Mid-Level Manager")
$objUser.Put("department", "sales")
$objUser.Put("company", "Northwind Traders")
$objUser.Put("manager... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/CreateMultivaluedUsers/CreateMultivaluedUser.ps1 | CreateMultivaluedUser.ps1 | $aryText = Get-Content -Path ".\OneStepFurther.txt"
$strClass = "User"
$intUsers = 9
$strName = "cn=tempUser"
$objADSI = [ADSI]"LDAP://OU=MyTestOU,DC=Montel,DC=local"
for ($i = 1; $i -le $intUsers; $i++)
{
$objUser = $objADSI.Create($strCLass, $StrName + $i)
$objUser.setInfo()
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Script/AD [ADSI]/CreateMultipleOU/CreateMultipleOU.ps1 | CreateMultipleOU.ps1 | $aryText = Get-Content -Path ".\stepbystep.txt"
foreach ($aryElement in $aryText)
{
$strClass = "organizationalUnit"
$strOUName = $aryElement
$objADSI = [ADSI]"LDAP://OU=MyTestOU,DC=Montel,DC=local"
$objOU = $objADSI.Create($strCLass, $strOUName)
$objOU.SetInf... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/djoin.ps1 | djoin.ps1 | djoin /provision /domain domain.lab /machine nano-hc-01 /savefile c:\share\nano1.djoin
djoin /provision /domain domain.lab /machine nano-hc-02 /savefile c:\share\nano2.djoin
djoin /provision /domain domain.lab /machine nano1 /savefile c:\share\nano1.djoin
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/Create domain.ps1 | Create domain.ps1 | #
# Windows PowerShell script for AD DS Deployment
#
Import-Module -Name ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath 'C:\Windows\NTDS' `
-DomainMode 'Win2012' `
-DomainName 'domain.lab' `
-DomainNetbiosName 'DOMAIN' `
-ForestMode 'Win2012' `
-InstallDns:$true `
-LogPath... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/disableWU.ps1 | disableWU.ps1 | Clear-Host
Write-Host "0 -> Change setting in Windows Update app (default)"
Write-Host "1 -> Never check for updates (not recommended)"
Write-Host "2 -> Notify for download and notify for install"
Write-Host "3 -> Auto download and notify for install"
Write-Host "4 -> Auto download and schedule the install"
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/Password Change Notification.ps1 | Password Change Notification.ps1 | $smtpServer = 'blast.montel.no'
$expireindays = 15
$from = 'Company Administrator <noreply@montel.no>'
$logging = 'Enabled' # Set to Disabled to Disable Logging
$logFile = 'C:\Montel\logs\ad_password_log.csv' # ie. c:\mylog.csv
$testing = 'Disabled' # Set to Disabled to Email Users
$testRecipient = 'stian@montel.... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/add-proxyaddressToDL.ps1 | add-proxyaddressToDL.ps1 | $OU = 'OU=Distribution Groups,OU=Montel,DC=montel,DC=local'
$groups = Get-ADGroup -Filter * -SearchBase $OU -Properties SamAccountName, ProxyAddresses
foreach($group in $groups)
{
Set-ADGroup -Identity $group.SamAccountName -Add @{ProxyAddresses = 'smtp:'+ $group.SamAccountName + '@montelnews.com'}
}
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/Step-by-step-NOTES.ps1 | Step-by-step-NOTES.ps1 | # Laste ned siste versjon av Powershell
# https://www.microsoft.com/en-us/download/details.aspx?id=50395
# kj�re Powershell kode fra CMD
Powershell (-noexit) -command {& Get-Process}
# kj�re flere eksterne kommandoer i Powershell
ipconfig;route print
# Finne filversjon p� kj�rende programmer
Get-... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/ChangeVM_Hardware.ps1 | ChangeVM_Hardware.ps1 |
Enter-PSSession mon-mgmt11 -Credential (Get-Credential)
import-module virtualmachinemanager
$VM = "MON-LB-L"
Stop-SCVirtualMachine -VM $VM
Set-SCVirtualMachine -VM $VM -CPUCount 2 -MemoryMB 2048 -DynamicMemoryEnabled $false
start-SCVirtualMachine -VM $VM
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/create vm.ps1 | create vm.ps1 |
01..3 | % {
New-VM -ComputerName localhost -Generation 01 -MemoryStartupBytes 2GB -Name NANO-HC-0$_ -VHDPath C:\vm\nano-hc-0$_\nano-hc-0$_.vhd -Path c:\VM -SwitchName 'vSwitch Private'
}
01..3 | % {
Set-VMProcessor -VMName nano-hc-0$_ -ExposeVirtualizationExtensions $true
Set-VMMemory -VMName nano-hc-0$_ ... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/new-user.ps1 | new-user.ps1 | #requires -Version 2.0 -Modules ActiveDirectory
$salesAndAdminOU = 'OU=AdminAndSales,OU=Users,OU=Montel,DC=montel,DC=local'
$newOU = 'OU=News Desk,OU=Users,OU=Montel,DC=montel,DC=local'
$fullName = 'Stian Kåre Nordmann'
$department = 'news'
$password = 'Welcome123!'
$changePasswordAtLogon = $true
$office = '... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/new-userfunc.ps1 | new-userfunc.ps1 | function New-User
{
<#
.SYNOPSIS
Short Description
.DESCRIPTION
Detailed Description
.EXAMPLE
New-User
explains how to use the command
can be multiple lines
.EXAMPLE
New-User
another example
can have as many examples as you like
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/DeployFonts.ps1 | DeployFonts.ps1 | $Shell = New-Object -ComObject Shell.Application
$Folder = $Shell.Namespace(0x14)
$FontPath = Get-ChildItem .\files\fonts
foreach($File in $FontPath) {
if (!(Test-Path ($env:windir + "\Fonts\$File"))) {
$Folder.CopyHere($File.fullname,0x14)
}
}
exit |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/s2d.ps1 | s2d.ps1 | New-Cluster -Name S2D -Node nano1, nano-hc-02, nano-hc-03 -StaticAddress 10.0.10.100 -NoStorage
Set-ClusterQuorum -Cluster S2D -FileShareWitness \\dc1\S2DHCWitness
Enable-ClusterS2D -CimSession S2D -Autoconfig $false -SkipEligibilityChecks -CacheMode Disabled
Get-StorageProvider | Register-StorageSubsystem -Co... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/lastPasswordChange.ps1 | lastPasswordChange.ps1 | $searchBase = 'OU=AdminAndSales,OU=Users,OU=Montel,DC=montel,DC=local'
$searchBase = 'OU=News desk,OU=Users,OU=Montel,DC=montel,DC=local'
$searchBase = 'OU=Users,OU=SoftwareScenario,DC=montel,DC=local'
$searchBase = 'OU=External Users,DC=montel,DC=local'
Get-ADUser -Filter {
name -like '*'
} -SearchBase $se... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/diverse.ps1 | diverse.ps1 | [math]::PI
(dir -Directory).CreateSubdirectory('test')
$today = get-date
$today.DayOfWeek
$today.DayOfYear
$today.AddMonths(9)
#get-service -> gsv
Get-Service | Where-Object {$_.Status -eq 'Running'}
Get-Service | Select-Object Name, Status
Get-ChildItem 'C:\users\stians\Downloads' | Select-Object ... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/change_proxyaddresses.ps1 | change_proxyaddresses.ps1 | #requires -Version 2.0 -Modules ActiveDirectory
#users
$searchBase = 'OU=AdminAndSales,OU=Users,OU=Montel,DC=montel,DC=local'
$domain = '@montelnews.com'
$users = Get-ADUser -Filter {
name -like '*'
} -SearchBase $searchBase -Properties SamAccountName, EmailAddress, ProxyAddresses, GivenName, Surname
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/remove-userfromgroups.ps1 | remove-userfromgroups.ps1 | $user = 'celin'
$groups = Get-ADPrincipalGroupMembership $user | where {$_.distinguishedName -like "*Distribution Groups*"} | select name
ForEach ($group in $groups) {
remove-adgroupmember -Identity $group.name -Member $user
}
Write-Host $groups
$groups | clip
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/djoin computer.ps1 | djoin computer.ps1 | Enter-PSSession -vmname nano-hc-01
djoin /requestodj /loadfile \\10.0.10.10\share\nano1.djoin /windowspath c:\windows /localos
shutdown -r -t 0
exit
Enter-PSSession -vmname nano-hc-02
djoin /requestodj /loadfile \\10.0.10.10\share\nano2.djoin /windowspath c:\windows /localos
shutdown -r -t 0
exit
Enter-PSSe... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/create nano server.ps1 | create nano server.ps1 | Set-Location C:\NanoServerImageGenerator
Import-Module .\NanoServerImageGenerator -Verbose
$pwd = ConvertTo-SecureString -AsPlainText -Force -String 'Password99'
1..3 | % {
New-NanoServerImage -MediaPath d:\ -TargetPath "c:\VM\nano-hc-0$_\nano-hc-0$_.vhd" -DeploymentType Guest -Edition Datacenter `
-C... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/Forloop.ps1 | Forloop.ps1 |
for(;;)
{
Get-Process -Name iexplore
Start-Sleep -Seconds 1
Write-Host '---'
} |
PowerShellCorpus/Github/Stiansaeten_Powershell/Drafts/Get-InstalledSoftware.ps1 | Get-InstalledSoftware.ps1 | $dteStart = Get-date
$query = "Select * from Win32_product"
Write-Host "Counting Installed Products. This may take a little while. " -ForegroundColor Green `n
Get-CimInstance -Query $query | Format-Table Name, Caption, Vendor, Version -Wrap -AutoSize
$dteEnd = Get-Date
$dteDiff = New-TimeSpan $dteStart $dteE... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Production/Untitled5.ps1 | Untitled5.ps1 | function Remove-GibraltarLogs
{
[CmdletBinding]
<#
.Synopsis
Script for å slette Gibraltar logs
.DESCRIPTION
Rapid Recovery fyller opp c:\ med log filer.
Dette scriptet kjører som en Scheduled Task for å slette disse filene
slik at de ikke fyller opp c:\
.EXAMPLE... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Production/Remove-GibraltarLogs.ps1 | Remove-GibraltarLogs.ps1 | function Remove-GibraltarLogs
{
<#
.Synopsis
Script for å slette Gibraltar logs
.DESCRIPTION
Rapid Recovery fyller opp c:\ med log filer.
Dette scriptet kjører som en Scheduled Task for å slette disse filene
slik at de ikke fyller opp c:\
.EXAMPLE
removeGibra... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Get-NetFramwork/Get-NetFramework.ps1 | Get-NetFramework.ps1 | #requires -Version 2
function Get-NetFramework
{
<#
.SYNOPSIS
Get the .NET Framework version
.DESCRIPTION
Get the .NET Framework version
.EXAMPLE
Get-NetFramework -ComputerName Server1, Server2
#>
param
(
[Param... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Send-MailMessageHTML/Send-MailMessageHTML.ps1 | Send-MailMessageHTML.ps1 | #requires -Version 2.0
function Send-MailMessageHTML
{
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline=$true)]
[Alias('PsPath')]
[ValidateNotNullOrEmpty()]
[string[]]
${Attachments},
[ValidateNotNullOrEmpty()]
[Collections.HashTable]
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Send-MailMessageHTML/example.ps1 | example.ps1 | $images = @{
image1 = 'C:\Temp\image.jpg'
image2 = 'C:\Temp\image2.jpg'
}
$body = @'
<html>
<body>
<h3>Tvillinger?</h3>
<br>
Julie ble vel 2 år og ble vel ikke til 2 personer..? :o<br>
<br>
<img src="cid:image1"><br>
</body>
</html>
'@
$params = @{... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Update-AzureDNS/Update-AzureDNS.ps1 | Update-AzureDNS.ps1 | #requires -Version 2 -Modules AzureRM.Dns
function Update-AzureDNS
{
<#
.SYNOPSIS
Update record in Azure
.DESCRIPTION
Update A record or CNAME record in Azure DNS
.EXAMPLE
Update-AzureDNS -RecordType a -name www -NewValue 1.2.3.4 -Zone... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Get-WmiNameSpace/Get-WmiNameSpace.ps1 | Get-WmiNameSpace.ps1 | function Get-WmiNameSpace{
Param(
$namespace = "root",
$computer = "localhost"
)
Get-WmiObject -Class __NAMESPACE -ComputerName $computer -Namespace $namespace -ErrorAction "SilentlyContinue" |
ForEach-Object -Process {
$subns = Join-Path -Path $_.__NAMESPACE -ChildPath $... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/ConvertTo-Speech/ConvertTo-Speech.ps1 | ConvertTo-Speech.ps1 | function ConvertTo-Speech
{
<#
.SYNOPSIS
Convert text to speech
.DESCRIPTION
Convert text to speech
.EXAMPLE
ConvertTo-Speech -Text 'This function rules'
The computer will the say 'This function rules'
.EXAMPLE
ConvertTo-Speech -Text... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Connect-Azure/Connect-Azure.ps1 | Connect-Azure.ps1 | function Connect-Azure
{
<#
.SYNOPSIS
Connects to AzureRM
.DESCRIPTION
.SYNOPSIS
Connects to AzureRM
.EXAMPLE
Connect-Azure -AzureRmSubscription 'Pay-As-you-Go'
#>
[CmdletBinding()]
param
(
[Par... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Get-WmiProvider/Get-WmiProvider.ps1 | Get-WmiProvider.ps1 | function Get-WmiProvider {
Param(
[string]$nameSpace,
[string]$computer)
Get-CimInstance -ClassName __Provider -Namespace $nameSpace |
Sort-Object -Property Name |
Select-Object name
}#end function Get-WmiProvider |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Get-Uptime/Get-Uptime.ps1 | Get-Uptime.ps1 | #requires -Version 2
function Get-Uptime
{
<#
.SYNOPSIS
Get the latest boot time and calculate the uptime
.DESCRIPTION
Get the latest boot time and calculate the uptime
.EXAMPLE
Get-Uptime -ComputerName server1-cred domain\user
#>... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Get-LastReboot/Get-LastReboot.ps1 | Get-LastReboot.ps1 | #requires -Version 2
function Get-LastReboot
{
<#
.DESCRIPTION
Get the last reboot information from multiple machines
.Example
Get-LastReboot -ComputerName SRV,SRV2
ComputerName LastReboot DaysAgo HoursAgo
------------ ---------- ------- --------
SRV1 4/23/... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Remove-AzureDNS/Remove-AzureDNS.ps1 | Remove-AzureDNS.ps1 | #requires -Version 2 -Modules AzureRM.Dns
function Remove-AzureDNS
{
<#
.SYNOPSIS
Create record in Azure
.DESCRIPTION
Create A record or CNAME record in Azure DNS
.EXAMPLE
Remove-AzureDNS -RecordType a -name www -ZoneName domain.com -R... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Functions/Add-AzureDNS/Add-AzureDNS.ps1 | Add-AzureDNS.ps1 | function Add-AzureDNS
{
<#
.SYNOPSIS
Create record in Azure
.DESCRIPTION
Create A record or CNAME record in Azure DNS
.EXAMPLE
Add-AzureDNS -RecordType a -name www -Value 1.2.3.4 -ZoneName domain.com -ResouceGroupName MyRG -Verbose
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/ServerManagement/init.ps1 | init.ps1 |
# use this file to define global variables on module scope
# or perform other initialization procedures.
# this file will not be touched when new functions are exported to
# this module.
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/ServerManagement/Get-NetFramework.ps1 | Get-NetFramework.ps1 | function Get-NetFramework
{
<#
.SYNOPSIS
Get the .NET Framework version
.DESCRIPTION
Get the .NET Framework version
.EXAMPLE
Get-NetFramework -ComputerName Server1, Server2
#>
[CmdletBinding()]
param
(
[Para... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/ServerManagement/Get-LastReboot.ps1 | Get-LastReboot.ps1 | function Get-LastReboot
{
<#
.DESCRIPTION
Get the last reboot information from multiple machines
.Example
Get-LastReboot -ComputerName SRV,SRV2
ComputerName LastReboot DaysAgo HoursAgo
------------ ---------- ------- --------
SRV1 4/23/2016 5:55:42 AM 28 674... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/ServerManagement/Get-Uptime.ps1 | Get-Uptime.ps1 | function Get-Uptime
{
<#
.SYNOPSIS
Get the latest boot time and calculate the uptime
.DESCRIPTION
Get the latest boot time and calculate the uptime
.EXAMPLE
Get-Uptime -ComputerName server1-cred domain\user
#>
[CmdletBinding()... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/AzureManagement/Add-AzureDNS.ps1 | Add-AzureDNS.ps1 | function Add-AzureDNS
{
<#
.SYNOPSIS
Create record in Azure
.DESCRIPTION
Create A record or CNAME record in Azure DNS
.EXAMPLE
Add-AzureDNS -RecordType a -name www -Value 1.2.3.4 -ZoneName domain.com -ResouceGroupName MyRG -Verbose
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/AzureManagement/init.ps1 | init.ps1 |
# use this file to define global variables on module scope
# or perform other initialization procedures.
# this file will not be touched when new functions are exported to
# this module.
|
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/AzureManagement/Remove-AzureDNS.ps1 | Remove-AzureDNS.ps1 | function Remove-AzureDNS
{
<#
.SYNOPSIS
Create record in Azure
.DESCRIPTION
Create A record or CNAME record in Azure DNS
.EXAMPLE
Remove-AzureDNS -RecordType a -name www -ZoneName domain.com -ResouceGroupName MyRG
.EXAMPLE
... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/AzureManagement/Connect-Azure.ps1 | Connect-Azure.ps1 | function Connect-Azure
{
<#
.SYNOPSIS
Connects to AzureRM
.DESCRIPTION
.SYNOPSIS
Connects to AzureRM
.EXAMPLE
Connect-Azure -AzureRmSubscription 'Pay-As-you-Go'
#>
[CmdletBinding()]
param
(
[Par... |
PowerShellCorpus/Github/Stiansaeten_Powershell/Modules/AzureManagement/Update-AzureDNS.ps1 | Update-AzureDNS.ps1 | function Update-AzureDNS
{
<#
.SYNOPSIS
Update record in Azure
.DESCRIPTION
Update A record or CNAME record in Azure DNS
.EXAMPLE
Update-AzureDNS -RecordType a -name www -NewValue 1.2.3.4 -ZoneName domain.com -ResouceGroupName MyRG
... |
PowerShellCorpus/Github/gurpreet-ahluwalia_ARM-Templates/POC/POC/bin/Debug/staging/POC/Scripts/Deploy-AzureResourceGroup.ps1 | Deploy-AzureResourceGroup.ps1 | #Requires -Version 3.0
#Requires -Module AzureRM.Resources
#Requires -Module Azure.Storage
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
[string] $ResourceGroupName = 'POC',
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageAccountResourceGr... |
PowerShellCorpus/Github/gurpreet-ahluwalia_ARM-Templates/POC/POC/Scripts/Deploy-AzureResourceGroup.ps1 | Deploy-AzureResourceGroup.ps1 | #Requires -Version 3.0
#Requires -Module AzureRM.Resources
#Requires -Module Azure.Storage
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
[string] $ResourceGroupName = 'POC',
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageAccountResourceGr... |
PowerShellCorpus/Github/joshatwell_PowerCLI/Functions/Clone-List.ps1 | Clone-List.ps1 | Function Clone-List{
<#
.Synopsis
Will initiate a clone for a list of VMs.
.Description
This function expands the standard New-VM cmdlet by dynamically assigning
specific parameters for the clone task.
.Example
Get-VM "*P1app*" | Clone-List
You can pull list of VMs with Get-VM and pass ... |
PowerShellCorpus/Github/joshatwell_PowerCLI/Functions/Test-vMotion.ps1 | Test-vMotion.ps1 | Function Test-vMotion{
<#
.Synopsis
Performs .CheckMigrate method for all VMs in a cluster to determine if they
are capable of being migrated.
.Description
Performs .CheckMigrate method for all VMs in a cluster to determine if they
are capable of being migrated. Also able to check a single V... |
PowerShellCorpus/Github/joshatwell_PowerCLI/Functions/Set-LocalDatastoreName.ps1 | Set-LocalDatastoreName.ps1 | Function Set-LocalDatastoreName{
<#
.Synopsis
Renames the local datastore of an ESX(i) host to a name based
on Hostname and a defined suffix. Default suffix is "-local"
.Example
Get-Cluster "Test1" | Get-VMHost | Set-LocalDatastoreName
This will rename the local datastores of all VMHosts in clu... |
PowerShellCorpus/Github/joshatwell_PowerCLI/Scripts/Get-StatInterval-All-VCs.ps1 | Get-StatInterval-All-VCs.ps1 | <#
====================================================================
Author(s): Josh Atwell <josh.c.atwell@gmail.com>
File: Get-StatInterval-All-VCs.ps1
Purpose: Email report of the StatIntervals for All VCs listed
in array. Needed because Statistics level is not
provided in Get-StatInterval cmd... |
PowerShellCorpus/Github/kolamo_Create-SPWebStructure/Create-SPWebStructure.ps1 | Create-SPWebStructure.ps1 | ### .\Create-SPWebStructure.ps1
### Name : Create-SPWebStructure.ps1
### Purpose : Creates a web structure from a given csv file
### Author : Christian Unnerstall
### Version : 1.2
### Date : 2015/04/02
function Create-SPWebStructure {
param(
[PARAMETER(HelpMessage="Path of the SiteCollecti... |
PowerShellCorpus/Github/marcellusnav_Marshell/Company Scripts/NAV Create Companies.ps1 | NAV Create Companies.ps1 | <#
This script will create new empty companies with the names defined in the $Companies array.
Set the $NavServiceName and $NavVersion.
#>
# 71, 80, 90, 100
$NavVersion = 100;
Import-Module "C:\Program Files\Microsoft Dynamics NAV\$($NavVersion)\Service\NavAdminTool.ps1"
$NavServiceName = 'Dynami... |
PowerShellCorpus/Github/marcellusnav_Marshell/User Scripts/NAV Create NAV Users From CSV.ps1 | NAV Create NAV Users From CSV.ps1 | <#
This script will read a CSV file where the usernames are entered for the new users and create new user records.
It will also assign the permission sets defined in the $PermissionSets array to the users.
Set the $NavServiceName and $NavVersion.
#>
$workfolder = (Get-Item $psISE.CurrentFile.FullPath... |
PowerShellCorpus/Github/marcellusnav_Marshell/User Scripts/NAV Add Me As Super User To All ServiceInstances On Server.ps1 | NAV Add Me As Super User To All ServiceInstances On Server.ps1 | <#
This script will create a new a user record with the current user id and assign super permission set to the new user in all server instances
on the current server.
Set the $NavVersion.
#>
# 71, 80, 90, 100
$NavVersion = 100;
Import-Module "C:\Program Files\Microsoft Dynamics NAV\$($NavVersio... |
PowerShellCorpus/Github/marcellusnav_Marshell/User Scripts/NAV Quick Add Me As Super User.ps1 | NAV Quick Add Me As Super User.ps1 | <#
This script will create a new a user record with the current user id and assign super permission set to the new user.
Set the $NavServiceName and $NavVersion.
#>
# NAV Service Tier Name
$NavServiceName = '';
# 71, 80, 90, 100
$NavVersion = 90;
Import-Module "C:\Program Files\Microsoft Dynamics ... |
PowerShellCorpus/Github/aney1_Firefox-Webextension-Statistics/firefox_addons_webext.ps1 | firefox_addons_webext.ps1 | <#
#
# This script is using the REST API (http://addons-server.readthedocs.io/en/latest/topics/api/addons.html) of addons.mozilla.org to get the number of webextensions compared to other types of extensions.
# It's exporting the data as a csv file.
# I'm running this script daily and the data is presented prettier ... |
PowerShellCorpus/Github/OGGM_OGGM-Anaconda/ci/install_miniconda.ps1 | install_miniconda.ps1 | # Sample script to install Python and pip under Windows
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
$BASE_URL = "https://www.python.org/ftp/python/"
function ... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/Modernizr.2.6.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/Modernizr.2.6.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/Modernizr.2.6.2/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/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/tiup_tiup-sso-sdk-csharp/sample/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/tiup_tiup-sso-sdk-csharp/sample/packages/Newtonsoft.Json.6.0.8/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWin... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.UI.Combined.1.8.24/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $juiFileNameRegEx |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.UI.Combined.1.8.24/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $juiFileNameRegEx ... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.UI.Combined.1.8.24/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.1.8.2/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/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.1.8.2/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
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/sample/packages/jQuery.1.8.2/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/tiup_tiup-sso-sdk-csharp/src/packages/Newtonsoft.Json.6.0.7/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json"
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Con... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/src/packages/Microsoft.Bcl.Build.1.0.14/tools/Install.ps1 | Install.ps1 | param($installPath, $toolsPath, $package, $project)
# This is the MSBuild targets file to add
$targetsFile = [System.IO.Path]::Combine($toolsPath, $package.Id + '.targets')
# Need to load MSBuild assembly if it's not loaded yet.
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=ne... |
PowerShellCorpus/Github/tiup_tiup-sso-sdk-csharp/src/packages/Microsoft.Bcl.Build.1.0.14/tools/Uninstall.ps1 | Uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
# Need to load MSBuild assembly if it's not loaded yet.
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
# Grab the loaded MSBuild project for the project
# Normalize project path before calli... |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/jQuery.1.10.2/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/wcadap_Contact_Page_Final/Contacts/packages/jQuery.1.10.2/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
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/jQuery.1.10.2/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/wcadap_Contact_Page_Final/Contacts/packages/Modernizr.2.6.2/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Update the _references.js file
Remove-Reference $scriptsFolderProjectItem $modernizrFileNameRegEx |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/Modernizr.2.6.2/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
if ($scriptsFolderProjectItem -eq $null) {
# No Scripts folder
Write-Host "No Scripts folder found"
exit
}
# Update the _references.js file
AddOrUpdate-Reference $scriptsFolderProjectItem $modernizrFileName... |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/Modernizr.2.6.2/Tools/common.ps1 | common.ps1 | function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProject... |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/EntityFramework.6.1.2/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
# MIIa2AYJKoZIhvcNAQcCoIIayTCCGsUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQ... |
PowerShellCorpus/Github/wcadap_Contact_Page_Final/Contacts/packages/EntityFramework.6.1.2/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/OPSTest_E2E_Provision_1488527526978/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/OPSTest_E2E_Provision_1488236741577/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/OPSTest_E2E_Provision_1488290741276/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/stormyseliquini_fullstacktodo/backend/vstdaAPI/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/stormyseliquini_fullstacktodo/backend/vstdaAPI/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/stormyseliquini_fullstacktodo/backend/vstdaAPI/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
$compilerPackageName = 'Microsoft.Net.Compilers'
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$libDirectory = Join-Path $installPath 'lib\net45'
$packageDirectory = Split-Path $installPath
$compilerPackage = Get-Chil... |
PowerShellCorpus/Github/stormyseliquini_fullstacktodo/backend/vstdaAPI/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$projectRoot = $project.Properties.Item('FullPath').Value
$binDirectory = Join-Path $projectRoot 'bin'
$targetDirectory = Join-Path $binDirectory $roslynSubFolder
if (Te... |
PowerShellCorpus/Github/stormyseliquini_fullstacktodo/backend/vstdaAPI/packages/Newtonsoft.Json.6.0.4/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json"
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Con... |
PowerShellCorpus/Github/BenK008_PowerShell_Scripts/Get-ServerInfo.ps1 | Get-ServerInfo.ps1 | <#
.Synopsis
Gets necessary information to monitor selected servers real-time
.DESCRIPTION
The Get-ServerInfo cmdlet gets necessary information needed when monitoring servers. Get-ServerInfo shows when the servers go offline, or when they are unable to be reached. Additionally, Get-ServerInfo will display pertinen... |
PowerShellCorpus/Github/Bolgermi_Powershell/remove_bloatware.ps1 | remove_bloatware.ps1 | # Script to remove preinstalled apps from Windows 10
# Updates sometimes reinstall them, so it's handy to have this script to hand
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
Get-AppxPackage *windowscalculator* | Remove-AppxPackage
Get-AppxPackage *... |
PowerShellCorpus/Github/OPS-E2E-PPE_E2E_D_NewRepo_2017_4_21_14_58_23/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstorageprod.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source url: ... |
PowerShellCorpus/Github/ServiceDudes_cMDT/Build.ps1 | Build.ps1 | $moduleName = "cMDT"
$allResources = @( Get-ChildItem -Path $PSScriptRoot\src\DSCResources\*.psm1 -ErrorAction SilentlyContinue -Recurse | Sort-Object)
$allFunctions = @( Get-ChildItem -Path $PSScriptRoot\src\Public\*.ps1 -ErrorAction SilentlyContinue -Recurse | Sort-Object)
$moduleVersion = "1.0.0.6"
$com... |
PowerShellCorpus/Github/ServiceDudes_cMDT/src/Public/Write-Log.ps1 | Write-Log.ps1 | Function Write-Log
{
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory=$True)]
[ValidateNotNullorEmpty()]
$Message
)
[String]$LogFile = "$($PSScriptRoot)\$(Get-Date -Format "yyyy-MM-dd")_cMDT.log"
Out-File -FilePath $LogFile -InputObject $Messa... |
PowerShellCorpus/Github/ServiceDudes_cMDT/src/Public/Invoke-CreatePath.ps1 | Invoke-CreatePath.ps1 | Function Invoke-CreatePath
{
[CmdletBinding(SupportsShouldProcess=$true)]
[OutputType([bool])]
param(
[Parameter(Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$Path,
[Parameter()]
[string]$PSDriveName,
[Parameter()]
[string]$PSDri... |
PowerShellCorpus/Github/ServiceDudes_cMDT/src/Public/Get-FileNameFromPath.ps1 | Get-FileNameFromPath.ps1 | ÔĽŅFunction Get-FileNameFromPath
{
[CmdletBinding()]
[OutputType([string])]
param(
[Parameter(Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$Path,
[Parameter(Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$Separator
)
[stri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.