full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/1. Adobe Flash Player/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## This installs the old version of Flash for the demo
if (-not (Test-InstalledSoftware -Name 'Adobe Flash Player 10 Plugin' -Version '10.1.53.64')) {
Install-Software -OtherIns... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/1. Adobe Flash Player/upgrade.ps1 | upgrade.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
if (Test-InstalledSoftware -Name 'Adobe Flash Player 10 Plugin' -Version '10.1.53.64') {
& "$WorkingDir\uninstall.ps1"
}
## Start the installer
Install-Software -OtherInstalle... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/3. Oracle Java/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$VersionToKeep = @{ 'NumericVersion' = '6.0.200'
'NameVersion' = 'Java(TM) 6 Update 20'
}
Stop-MyProcess -ProcessName 'iexplore'
Get-Instal... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/3. Oracle Java/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## Stop the Program Compatbiility Assistance service. It interferes with installing old versions
Get-Service -Name PcaSvc -ErrorAction SilentlyContinue | Stop-Service
$OldInstall... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/3. Oracle Java/upgrade.ps1 | upgrade.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
& "$WorkingDir\uninstall.ps1"
Install-Software -OtherInstallerFilePath "$WorkingDir\jre-8u45-windows-i586.exe" -OtherInstallerArgs '/s'
|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/2. Adobe Reader/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Stop-MyProcess 'AcroRd32', 'Acrobat.com', 'Adobe_Updater' -Verbose
Start-Process "$WorkingDir\AdbeArCleaner_v2.exe" -ArgumentList '/silent /product=1' -Wait -NoNewWindow
Get-Insta... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/2. Adobe Reader/upgrade.ps1 | upgrade.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## This upgrade example shows calling the already built uinstall script,
## testing for the existing of critical files in the upgrade script
## and finally installing a simple MSI. T... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/4. Upgrades/2. Adobe Reader/v7/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
if (-not (Test-Path -Path "$WorkingDir\Adobe Reader 7.0.msi" -PathType Leaf)) {
Write-Log -Message "The installer $WorkingDir\Adobe Reader 7.0.msi can't be found" -LogLevel 3
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/5. QuickTime Player/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
# Pretend like we've exchausted all other options
$Guid = (Get-InstalledSoftware -Name 'Apple Application Support').GUID
Uninstall-ViaMsizap -MsizapFilePath 'C:\MyDeployment\msizap.ex... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/5. QuickTime Player/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## Install QuickTime Player for demo purposes on launch server
Install-Software -MsiInstallerFilePath "$WorkingDir\AppleApplicationSupport.msi"
Install-Software -MsiInstallerFilePat... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/2. EMET/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Get-InstalledSoftware -Name 'EMET 5.1' | Remove-Software
|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/4. Cisco AnyConnect/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$InstallLocation = "$(Get-32BitProgramFilesPath)\Cisco\Cisco NAC Agent"
Get-InstalledSoftware -Name 'Cisco NAC Agent' | Remove-Software -RemoveFolder "$(Get-AllUsersProfileFolderPa... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/3. Adobe Reader/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Get-InstalledSoftware -Name 'Adobe Reader XI' | Remove-Software -KillProcess 'AcroRd32', 'Acrobat.com', 'Adobe_Updater'
Remove-ProfileItem 'AppData\Local\Adobe\Acrobat', 'AppData\Local... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/3. Uninstalls/1. Web Apps/uninstall.ps1 | uninstall.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$WebAppUrl = 'http://www.somecompanywebapp.com'
## Kill all IE instances
Stop-MyProcess -ProcessName 'iexplore'
## Remove all shortcuts with the URL
Get-Shortcut -MatchingTarget... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/5. Configuration/1. User Profile Scripting/Install.ps1 | Install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
## Create a file on every user's desktop
$FileName = 'Sometextfile.txt'
Get-UserProfilePath | Where {Test-Path "$_\Desktop" } | foreach { $null = New-Item -Path "$_\Desktop" -Type File -Name $FileName }
## Ensure that the file was created
Get-UserProfil... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/5. Configuration/1. User Profile Scripting/ProfileItems.ps1 | ProfileItems.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1 -DisableNameChecking
## Create a file on every user's desktop
$FileName = 'Sometextfile.txt'
Get-UserProfilePath | Where {Test-Path "$_\Desktop" } | foreach { $null = New-Item -Path "$_\Desktop" -Type File -Name $FileName }
## Ensure that the file was cr... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/4. Web Apps/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
New-Shortcut -CommonLocation AllUsersDesktop -Name 'Shortcut to Web App' -TargetPath 'http://www.somecompanywebapp.com'
|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/1. EMET/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
if (-not (Test-InstalledSoftware -Name 'EMET 5.1')) {
if (((Get-OperatingSystem) -match 'Windows 7') -and (-not (Test-InstalledSoftware -Name 'Microsoft .NET Framework 4 Client P... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/3. Cisco AnyConnect/uninstall.TempPoint.ps1 | uninstall.TempPoint.ps1 | Import-Module \\configmanager\deploymentmodules\SoftwareInstallManager
Start-Log
Start-Process -FilePath "$(Get-InstallLocation -ProductName 'Cisco AnyConnect Secure Mobility Client')\Uninstall.exe" -ArgumentList '-remove -silent' -NoNewWindow -Wait
Get-InstalledSoftware -Name 'Cisco AnyConnect Diagnostics and Rep... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/3. Cisco AnyConnect/detect.TempPoint.ps1 | detect.TempPoint.ps1 | Import-Module \\configmanager\deploymentmodules\SoftwareInstallManager -DisableNameChecking
Start-Log
## Check if all software was installed
$SoftwareToValidate = @(
@{ 'Title' = 'Cisco AnyConnect Diagnostics and Reporting Tool'; 'Version' = '3.1.05182' },
@{ 'Title' = 'Cisco AnyConnect Network Access Manager'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/3. Cisco AnyConnect/uninstall.ps1 | uninstall.ps1 | Import-Module \\configmanager\deploymentmodules\SoftwareInstallManager
if ((Get-OperatingSystem) -notmatch 'XP') {
Import-Module \\configmanager\deploymentmodules\MSI
}
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Start-Log
$MobilityClientInstallLoc = Get-InstallLocation -ProductName 'Cisco ... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/3. Cisco AnyConnect/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$SoftwareInstallers = @(
@{ 'Title' = 'Cisco AnyConnect Secure Mobility Client'; 'Version' = '3.1.05182'; 'Installer' = 'anyconnect-win-3.1.05182-pre-deploy-k9.msi'; 'MsiExecSwitches'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/3. Cisco AnyConnect/detect.ps1 | detect.ps1 | Import-Module \\configmanager\deploymentmodules\SoftwareInstallManager -DisableNameChecking
Start-Log
## Check if all software was installed
$SoftwareToValidate = @(
@{ 'Title' = 'Cisco AnyConnect Diagnostics and Reporting Tool'; 'Version' = '3.1.05182' },
@{ 'Title' = 'Cisco AnyConnect Network Access Manager'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/5. Windows Features/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$FeatureName = 'SNMP-Service'
if ((Get-OperatingSystem) -match 'Server') {
Write-Log -Message "The operating system is $(Get-OperatingSystem)"
if (-not (Get-WindowsFeature ... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/2. Adobe Reader/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
if (-not (Test-Path -Path "$WorkingDir\AcroRead.msi" -PathType Leaf)) {
Write-Log -Message "The installer $WorkingDir\AcroRead.msi can't be found" -LogLevel 3
exit 2
} else... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/TechMentor 2015 - Automating Software Install with Powershell/Demos/1. Installs/6. Installation Detection/Cisco AnyConnect/detect.ps1 | detect.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$SoftwareToValidate = @(
@{ 'Title' = 'Cisco AnyConnect Diagnostics and Reporting Tool'; 'Version' = '3.1.05182' },
@{ 'Title' = 'Cisco AnyConnect Network Access Manager'; 'Version'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/UnitTestIntro.ps1 | UnitTestIntro.ps1 | #region Intro
function Get-Something
{
param (
[Parameter()]
[bool]$Param
)
## Start the code "flow" which changes direction depending on circumstances
## If $Param was used, do something
if ($PSBoundParameters.ContainsKey('Param')) {
if ($Param -eq $true)
{
## Return a pscustomobje... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/ClassBasedDSCResource.Tests.ps1 | ClassBasedDSCResource.Tests.ps1 | using module '.\GHI.DSC.NetworkAdapter.psm1'
InModuleScope 'GHI.DSC.NetworkAdapter' {
describe 'Get' {
## Instantiate a new GHI_NetworkAdapter object
$dnsSrvAddress = [GHI_DnsServerAddress]::new()
## Assign all the mandatory properties to the object. This sets all of the properties we'll be tes... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/BasicScript.ps1 | BasicScript.ps1 | param (
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$FilePath,
[Parameter()]
[ValidateNotNullOrEmpty()]
[switch]$PassThru
)
## Test to see if the file already exists. If so, I don't want to modify it.
if (Test-Path -Path $FilePath -PathType Leaf)
{
throw "A file already exists at [$... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/Script-WithoutMocking.Tests.ps1 | Script-WithoutMocking.Tests.ps1 |
describe 'BasicScript' {
$params = @{
FilePath = 'C:\MyFile.txt'
}
it 'throws an exception if a file already exists' {
## Ensure the file already exists to ensure the test fails. This is a no-no in unit tests.
## Mocking will come to the rescue in a minute.
Add-Content -Path $params.Fi... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/UnitTestIntro-2.ps1 | UnitTestIntro-2.ps1 | function Get-Something
{
param (
[Parameter()]
[bool]$Param
)
## Start the code "flow" which changes direction depending on circumstances
## If $Param was used, do something
if ($PSBoundParameters.ContainsKey('Param'))
{
if ($Param -eq $true)
{
## Return a pscustomobject if Param is t... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/Mock.Tests.ps1 | Mock.Tests.ps1 |
describe 'BasicScript' {
$params = @{
FilePath = 'C:\MyFile.txt'
}
it 'throws an exception if a file already exists' {
mock 'Test-Path' {
return $true
}
## Run the script and test output by enclosing the call in curly braces to capture the exception
{ & "$PSScriptRoot\BasicScr... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/DSC Camp 2016/Mock-Simple.ps1 | Mock-Simple.ps1 | function Hello-World
{
Write-Output -InputObject 'I am in the Hello-World function'
}
#Hello-World
describe 'SimpleMockExample' {
it 'returns what I would expect without mocking' {
Hello-World | should be 'I am in the Hello-World function'
}
it 'returns something new when mocked' {
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Start-Demo.ps1 | Start-Demo.ps1 | #region Demo setup
$demoPath = 'C:\Dropbox\GitRepos\Session-Content\Live Talks\User Group Talks\Making Software Deployments Suck Less'
<<<<<<< HEAD
Invoke-Pester -Path $demoPath
#endregion
#region Example deployment -- I'll go over the details in a minute
## All installer files and pre-created scripts are... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Talk.Tests.ps1 | Talk.Tests.ps1 | describe 'talk tests' {
$demoPath = 'C:\Dropbox\GitRepos\Session-Content\Live Talks\User Group Talks\Making Software Deployments Suck Less'
$vms = @('DC', 'CLIENT1', 'CLIENT2', 'SCCM', 'MEMBERSRV1')
it 'all VMs are online' {
foreach ($vm in $vms)
{
Test-Connection -ComputerName $vm -Quiet -Coun... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/New-CMMyApplication.ps1 | New-CMMyApplication.ps1 | [CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]$Name,
[Parameter(Mandatory)]
[string]$Manufacturer,
[Parameter(Mandatory)]
[ValidatePattern('[-+]?([0-9]*\.[0-9]+|[0-9]+)')]
[string]$SoftwareVersion,
[Parameter(Mandatory)]
[ValidateScript({ Test-Path -Path $_ -PathType Container })]
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/2. Logging/1. Logging/logging.ps1 | logging.ps1 | ## Bring up CMTrace. CMTrace is great for formatting, real-time log analysis, etc
& "C:\Program Files (x86)\ConfigMgr 2012 Toolkit R2\ClientTools\CMTrace.exe"
## Show log levels
Import-Module \\LABDC.LAB.LOCAL\Deployments\SoftwareInstallManager.psm1
Start-Log
Write-Log -Message 'something normal'
Write-Log -... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/SoftwareInstallManager/Tests/SoftwareInstallManager.Tests.ps1 | SoftwareInstallManager.Tests.ps1 | #region import modules
$ThisModule = "$($MyInvocation.MyCommand -replace '\.Tests\.ps1$')"
$RequiredModules = $ThisModule
#Import-Module -Name $RequiredModules -Force -ErrorAction Stop
ipmo c:\Dropbox\GitRepos\SoftwareInstallManager\SoftwareInstallManager.psd1
#endregion
InModuleScope SoftwareInstallManager {
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Company_Webapp/uninstall.ps1 | uninstall.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$WebAppUrl = 'http://www.somecompanywebapp.com'
## Kill all IE instances
Stop-MyProcess -ProcessName 'iexplore'
## Remove all shortcuts with the URL
Get-Shortcut -MatchingTar... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Company_Webapp/install.ps1 | install.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
New-Shortcut -CommonLocation AllUsersDesktop -Name 'Company Web App' -TargetPath 'http://www.somecompanywebapp.com'
|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Company_Webapp/detect.ps1 | detect.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$params = @{
'MatchingTargetPath' = 'http://www.somecompanywebapp.com/'
'MatchingName' = 'Company Web App'
'MatchingFilePath' = 'C:\Users\Public\Desktop'
}
if (Get-Shortcut @params)
{
$true
} |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Adobe_Reader/uninstall.ps1 | uninstall.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Stop-MyProcess 'AcroRd32', 'Acrobat.com', 'Adobe_Updater' -Verbose
Start-Process "$WorkingDir\AdbeArCleaner_v2.exe" -ArgumentList '/silent /product=1' -Wait -NoNewWindow
Get-Inst... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Adobe_Reader/install.ps1 | install.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## This upgrade example shows calling the already built uninstall script,
## testing for the existing of critical files in the upgrade script
## and finally installing a simple MSI... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Adobe_Reader/detect.ps1 | detect.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
if (Test-InstalledSoftware -Name 'Adobe Reader XI')
{
$true
} |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Adobe_Reader/v7/install.ps1 | install.ps1 | Import-Module C:\MyDeployment\SoftwareInstallManager.psm1
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
if (-not (Test-Path -Path "$WorkingDir\Adobe Reader 7.0.msi" -PathType Leaf)) {
Write-Log -Message "The installer $WorkingDir\Adobe Reader 7.0.msi can't be found" -LogLevel 3
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Cisco_AnyConnect/uninstall.ps1 | uninstall.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$InstallLocation = "$(Get-32BitProgramFilesPath)\Cisco\Cisco NAC Agent"
Get-InstalledSoftware -Name 'Cisco NAC Agent' | Remove-Software -RemoveFolder "$(Get-AllUsersProfileFolderP... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Cisco_AnyConnect/install.ps1 | install.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$SoftwareInstallers = @(
@{ 'Title' = 'Cisco AnyConnect Secure Mobility Client'; 'Version' = '3.1.05182'; 'Installer' = 'anyconnect-win-3.1.05182-pre-deploy-k9.msi'; 'MsiExecSwitch... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Making Software Deployments Suck Less/Packages/Cisco_AnyConnect/detect.ps1 | detect.ps1 | Import-Module \\MEMBERSRV1\Packages\SoftwareInstallManager
Start-Log
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
## Check if all software was installed
$SoftwareToValidate = @(
@{ 'Title' = 'Cisco AnyConnect Diagnostics and Reporting Tool'; 'Version' = '3.1.05182' },
@{ 'Title' = 'Cisco An... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/PowerShell and Bash Sittin' in a Tree/demo.ps1 | demo.ps1 | q#region Intro
$SomeTextFile = 'C:\TextFile.txt'
## Create a new text file
$NewFile = New-Item -Path $SomeTextFile -Type File
## Add stuff to the text file
Add-Content -Path $SomeTextFile -Value 'some value here'
'pipeline input' | Add-Content -Path $SomeTextFile
## Read the text file and output an array (... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BadScriptExample.ps1 | BadScriptExample.ps1 | function Receive-Output
{
process { Write-Host $_ -ForegroundColor Green }
}
Write-Output "this is a test" | Receive-Output
Write-Host "this is a test" | Receive-Output
Write-Output "this is a test" |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/AfterScripts/Get-PxeLiteDump.ps1 | Get-PxeLiteDump.ps1 | <#
.SYNOPSIS
This script queries a list of computer names for DMP files in the path C:\programdata\1e\pxelite of each computer. Once
complete, the script will output all DMP files found sorted by the $SortBy parameter.
.PARAMETER SccmModulePath
The file path where the ConfigurationManager module is locat... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/AfterScripts/Save-FFBCMSoftwareUpdate.ps1 | Save-FFBCMSoftwareUpdate.ps1 | function Save-FFBCMSoftwareUpdate
{
<#
.Synopsis
Saves update files to the software update package specified
.DESCRIPTION
The Save-FFBCMSoftwareUpdate saves the software update file to the specified software update package.
.EXAMPLE
$params = @{
'DeploymentPackageName' = 'Server - 2012'
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/Add-WKIDsToIE11PilotGroup.ps1 | Add-WKIDsToIE11PilotGroup.ps1 | import-module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
set-location CAS:
Write-Host "Gathering list of machines with IE11 in ConfigMgr..." -ForegroundColor Cyan -BackgroundColor Black
$coll = Get-CMDevice -CollectionName 'Workstations - Internet Explorer 11'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/Clear-OSDLogs.ps1 | Clear-OSDLogs.ps1 | param(
$days
)
$path = "\\server01\osd\logs"
$day = (get-date -day 1) - (New-TimeSpan -days $days)
$logs = Get-ChildItem -Path $path | Where-Object {$_.Lastwritetime -lt $day}
Write-host "Log folders:"$logs.Count
write-warning "This script removes all logs from $path before $day!"
write-host "Are you sure y... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/Get-PXELiteDumps.ps1 | Get-PXELiteDumps.ps1 | Import-Module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
Set-Location CAS:
Write-Output "Gathering list of WKIDs..."
$wkids = Get-CMDevice -CollectionName "OSD Masters" | Select-Object -ExpandProperty Name
Set-Location C:\
$dumps = @()
Write-Output "Check... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/ServerProfile.ps1 | ServerProfile.ps1 | function configmgr {
$startpath = "$env:appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu"
$scpath = "C:\windows\system32"
$scfile = "cmd.exe"
$shell = new-object -comobject "Shell.Application"
$folder = $shell.Namespace($scpath)
$item = $folder.Parsename($sc... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/ClientPush.ps1 | ClientPush.ps1 | $source = "c:\ConfigMgr 2012 R2 CU4 client"
$comps = "machine01","machine02"
#$comps = get-content \\mymachine\shared\scripts\sccm\ClientPush\computers.txt
$workdir = "c:\temp\ConfigMgr2012R2CU4"
workflow ClientPush {
foreach ($comp in $comps) {
if (Test-Connection $comp -count 1) {
inl... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/Citrix_Profile_Performance.ps1 | Citrix_Profile_Performance.ps1 | <#
.SYNOPSIS
Check load time of Citrix profiles and total connected users
.DESCRIPTION
This script queries \\server01\citrixprofiles\CTXRoam to determine load time to browse the share.
If the load time is greater than 60 seconds, the email shows ATTENTION NEEDED.
This script also ... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/vmcleanup_W7.ps1 | vmcleanup_W7.ps1 | #Starts defragmentation on C: with HIGH priority and verbose output
start-process defrag.exe -argumentlist "c: -f -v"
#Updates group policy for user and computer
start-process gpupdate -argumentlist /force
#Updates McAfee VirusScan Definitions
start-process mcupdate.exe -workingdirectory "c:\Program Files (x86)\Mc... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/The Top 10 Worst PowerShell Script Mistakes/BeforeScripts/Save-FFBCMSoftwareUpdate.ps1 | Save-FFBCMSoftwareUpdate.ps1 | function Save-FFBCMSoftwareUpdate
{
<#
.Synopsis
Saves update files to the software update package specified
.DESCRIPTION
The Save-FFBCMSoftwareUpdate saves the software update file to the specified software update package.
.EXAMPLE
Save-FFBCMSoftwareUpdate -DeploymentPackageName "Server - $U... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Automating Software Installs With Powershell/Demos/Simple MSI with Patch/install.TempPoint.ps1 | install.TempPoint.ps1 | Import-Module \\configmanager\deploymentmodules\SoftwareInstallManager
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Start-Log
Stop-MyProcess 'AcroRd32', 'Acrobat.com', 'Adobe_Updater' -Verbose
Start-Process "$WorkingDir\AdbeArCleaner.exe" -ArgumentList '/silent /product=1' -Wait -NoNewWindow
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Automating Software Installs With Powershell/Demos/Simple MSI with Patch/install.ps1 | install.ps1 | Import-Module ..\Modules\SoftwareInstallManager.psm1 -DisableNameChecking
$WorkingDir = $MyInvocation.MyCommand.Path | Split-Path -Parent
Start-Log
$Params = @{
'MsiInstallerFilePath' = "$WorkingDir\AcroRead.msi"
'MspFilePath' = "$WorkingDir\AdbeRdrUpd11010.msp"
'MstFilePath' = "$WorkingDir\AcroRead.mst"
'... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Automating Software Installs With Powershell/Demos/Simple MSI with Patch/demo.ps1 | demo.ps1 | Import-Module ..\Modules\SoftwareInstallManager.psm1 -DisableNameChecking
Get-InstalledSoftwareInRegistry -Name 'Adobe*'
## Let's check the log file generated
## Use the module's function to get the Windows temp folder
Get-SystemTempFolderPath
## Look at the log generated
Import-Csv -Path "$(Get-SystemTempF... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Automating Software Installs With Powershell/Demos/General Functionality/demo.ps1 | demo.ps1 | Get-InstalledSoftwareInRegistry
|
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/DemoWalkthrough.ps1 | DemoWalkthrough.ps1 | #region Demo prep
$DemoFolderPath = 'C:\Dropbox\GitRepos\Session-Content\Live Talks\User Group Talks\Central Texas PowerShell User Group - Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms\Demos'
$ComputerName = 'CLIENT1'
$ServerName = 'MEMBERSRV1'
if (Test-Connection -ComputerName $Co... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/GUI/Globals.ps1 | Globals.ps1 | #--------------------------------------------
# Declare Global Variables and Functions here
#--------------------------------------------
#Sample function that provides the location of the script
function Get-ScriptDirectory
{
<#
.SYNOPSIS
Get-ScriptDirectory returns the proper location of the script.
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/WindowsServices.ps1 | WindowsServices.ps1 | ## Save our test client into a variable in case we need to test against something else later
$ComputerName = 'CLIENT1'
#region REQUIREMENT 1 - Allow helpdesk to see all Windows services
Get-Service -ComputerName $ComputerName | select *
## Get ALL properties just for investigation
$services = Get-WmiObject -... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/View-VNC.ps1 | View-VNC.ps1 | ## Statically use CLIENT1 just for testing. We'll fill that in with a variable later.
start -FilePath "\\MEMBERSRV1\ToolShare\vncviewer.exe" -Args "-connect CLIENT1" |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/EventLogs.ps1 | EventLogs.ps1 | ## Save our test client into a variable in case we need to test against something else later
$ComputerName = 'CLIENT1'
#region REQUIREMENT 1 - Allow helpdesk to query any event log by name
## Look through available cmdlets to figure out how to query event logs
Get-Command -Name *eventlog*
## I see event log ... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/InstalledUpdates.ps1 | InstalledUpdates.ps1 | ## Find installed updates on a test remote client
Get-HotFix -ComputerName CLIENT1
## Narrow this down to only the fields I'd like to see as defined by the helpdesk
Get-HotFix -ComputerName CLIENT1 | select description, hotfixid |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/Test-VNCInstalled.ps1 | Test-VNCInstalled.ps1 | function Test-VncInstalled
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$ComputerName
)
begin
{
$ErrorActionPreference = 'Stop'
function Get-InstalledSoftware
{
<#
.S... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/Deploy-VNC.ps1 | Deploy-VNC.ps1 | function Deploy-Vnc
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$ComputerName,
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Path -Path $_ -PathType Container... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/VNC/View-VNC.ps1 | View-VNC.ps1 | ## Statically use CLIENT2 just for testing. We'll fill that in with a variable later.
& "\\MEMBERSRV1\ToolShare\VNC_Binaries\vncviewer.exe" -connect CLIENT1 |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/VNC/Test-VNCInstalled.ps1 | Test-VNCInstalled.ps1 | function Test-VncInstalled
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$ComputerName
)
begin
{
$ErrorActionPreference = 'Stop'
function Get-InstalledSoftware
{
<#
.S... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Building a Graphical Client Troubleshooting Tool with PowerShell and WinForms/Demos/CLITools/VNC/Deploy-VNC.ps1 | Deploy-VNC.ps1 | function Deploy-Vnc
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$ComputerName,
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Path -Path $_ -PathType Container... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Getting Shit Done with SQL and DSC/tests.ps1 | tests.ps1 | |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Getting Shit Done with SQL and DSC/SqlServer.ps1 | SqlServer.ps1 | #requires -Version 5
Configuration SQLStandalone
{
param(
[pscredential]$SetupCredential ## Need to pass a credential for setup
)
## Download the xSQLServer module from the PowerShell Gallery
Import-DscResource -Module xSQLServer
## Run this DSC configuration on the localhost
... |
PowerShellCorpus/Github/adbertram_Session-Content/Live Talks/User Group Talks/Getting Shit Done with SQL and DSC/demo.ps1 | demo.ps1 | #region Intro to DSC
## Scenario #1 - Ensuring a file is present with something in it
## With PowerShell -- no validation or logging (GIT 'ER DONE!) bad
$filePath = 'C:\SomeImportFile.txt'
Add-Content -Path $filePath -Value 'Adam deserve a raise --from manager'
Get-Content -Path $filepath
del $filepath
## ... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/Altaro/HowToGetTheTop10VMsByDiskUtilization.ps1 | HowToGetTheTop10VMsByDiskUtilization.ps1 | #Requires -Version 4
$perfCounters = @(
'\Hyper-V Virtual Storage Device({0})\Read Bytes/sec',
'\Hyper-V Virtual Storage Device({0})\Write Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Read Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Write Bytes/sec'
)
Get-VM | where { $_.... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/Altaro/Get-VMDiskUtilization.ps1 | Get-VMDiskUtilization.ps1 | #Requires -Version 4
$perfCounters = @(
'\Hyper-V Virtual Storage Device({0})\Read Bytes/sec',
'\Hyper-V Virtual Storage Device({0})\Write Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Read Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Write Bytes/sec'
)
Get-VM | where { $_.... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/Altaro/test.ps1 | test.ps1 | #Requires -Version 4
$perfCounters = @(
'\Hyper-V Virtual Storage Device({0})\Read Bytes/sec',
'\Hyper-V Virtual Storage Device({0})\Write Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Read Bytes/sec',
'\Hyper-V Virtual IDE Controller (Emulated)({0})\Write Bytes/sec'
)
Get-VM | where { $_.... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/Altaro/Get-VMCheckpointSize.ps1 | Get-VMCheckpointSize.ps1 | ## Find all VMs that have a snapshot
Get-VM | where {$_.ParentSnapshotId } | ForEach-Object {
## Create a hashtable to store all the output properties
$output = [ordered]@{
'VMName' = $_.Name
}
## Get the size of both the BIN and VSV files in the VHD's snapshot folder
$output.'SnappedMemorySize (GB)' = [m... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/InfoWorld/PowerShell for the Windows System Administrator.ps1 | PowerShell for the Windows System Administrator.ps1 | #region Event log querying
## Event log single server query
Get-WinEvent -FilterHashtable @{LogName = 'System'; ID = 6005} -ComputerName labdc.lab.local
## Querying event logs across multiple servers
$Servers = Get-Content -Path C:\Servers.txt
foreach ($s in $Servers) {
Get-WinEvent -FilterHashtable @{LogNa... |
PowerShellCorpus/Github/adbertram_Session-Content/Articles/SearchWindowsServer/FileServer.ps1 | FileServer.ps1 | Configuration FileServer
{
Import-DscResource -Module PSDesiredStateConfiguration, xSmbShare,cNtfsAccessControl
Node 'MEMBERSRV1'
{
File 'Share1Folder'
{
Ensure = 'Present'
Type = 'Directory'
DestinationPath = 'C:\FileShare1'
}
File 'Share2Folder'
{
Ensure = 'Present'
Ty... |
PowerShellCorpus/Github/adbertram_Session-Content/Other/October 2015 Scripting Games/October 2015 Scripting Games.ps1 | October 2015 Scripting Games.ps1 | #requires -Version 3
function Get-RssFeed
{
<#
.SYNOPSIS
This function retrieved items from a RSS feed.
.DESCRIPTION
This function attempts to read all items that exist in a RSS feed. If found, it will then output a standard set
of attributes about each item that provide a useful representation of ... |
PowerShellCorpus/Github/adbertram_Session-Content/Other/December 2015 Scripting Games/Get-Uptime.ps1 | Get-Uptime.ps1 | #Requires -Version 4
function Get-Uptime
{
<#
.SYNOPSIS
This function queries a local or remote computer to find the time it was started up and calculates how long it has
been online.
.DESCRIPTION
This function uses a computer's event log to search for the event ID of 6005 in the System log to fi... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Altaro - Get More Done in Less Time with VMWare vSphere and PowerShell/Start-Demo.ps1 | Start-Demo.ps1 | #region Demo prep
## Run as administrator
Get-Process 'chrome','iexplore' -ea Ignore | Stop-Process
Set-ExecutionPolicy -ExecutionPolicy Restricted -Force
#endregion
#region Download and install PowerCLI
## Run the installer
& C:\VMware-PowerCLI-6.3.0-3737840.exe
#endregion
#region Set the execution ... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Exporting an Azure SQL Database Resultset to CSV.ps1 | Exporting an Azure SQL Database Resultset to CSV.ps1 | ## GOAL: The query an Azure SQL database and convert the result into a CSV file
#Requires -Version 4
$demoPath = 'C:\Dropbox\GitRepos\Session-Content\Webinars\Ipswitch - Top 5 tasks IT administrators can automate'
#region Download and install all prereqs
$files = [ordered]@{
'SQLSysClrTypes.msi' = 'http:/... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Automating a Remote Physical to Virtual Server Conversion.ps1 | Automating a Remote Physical to Virtual Server Conversion.ps1 | #Requires -Version 4
function Convert-PhysicalDiskVolume
{
<#
.SYNOPSIS
This function converts all disks on a remote physical compputer to VHDs and transfers them to a location.
.DESCRIPTION
Remote computer requirements:
PowerShell remoting enabled and available
The C$ share is available
... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Automating New Employee Provisioning-Function.ps1 | Automating New Employee Provisioning-Function.ps1 | function New-EmployeeOnboardUser
{
<#
.SYNOPSIS
This function automates a lot of the common tasks that must happen when a new employee is hired. It defaults to all of the company standards but allows for ad-hoc changing if necessary. It will create the AD user account, add the account to the appropriate groups ... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Automating a Remote Physical to Virtual Server Conversion-Demo.ps1 | Automating a Remote Physical to Virtual Server Conversion-Demo.ps1 | ## GOAL: To remotely convert physical disks to VHDs and transfer back to a remote location.
#region Demo setup
$demoPath = 'C:\Dropbox\GitRepos\Session-Content\Webinars\Ipswitch - Top 5 tasks IT administrators can automate'
Add-Content -Path '\\MEMBERSRV1\c$\MEMBERSRV1.vhd' -Value '' -ea SilentlyContinue
#end... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Automating New Employee Provisioning-Demo.ps1 | Automating New Employee Provisioning-Demo.ps1 | #region Demo setup
$demoPath = 'C:\Dropbox\GitRepos\Session-Content\Webinars\Ipswitch - Top 5 tasks IT administrators can automate'
## Cleanup existing home folders
'IUser', 'ISecondUser', 'BNumber1', 'BNumber2', 'BNumber3' | foreach { del "\\MEMBERSRV1\Users\$_" -ea SilentlyContinue }
## Exit any existing sess... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Keeping Active Directory Healthy.ps1 | Keeping Active Directory Healthy.ps1 | <#
Title: Keeping Active Directory Healthy
Prerequisites:
Computer is in an Active Directory domain
Domain administrator privileges
PowerShell v4+
Server 2012 R2 domain controllers
Remote Server Administration Tools (RSAT) installed
- with the Active Directory PowerShell module enab... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Top 5 tasks IT administrators can automate/Automating New Employee Provisioning.Tests.ps1 | Automating New Employee Provisioning.Tests.ps1 | describe 'New-EmployeeOnboardUser' {
$credential = Get-Credential
$commonAdParams = @{
'Credential' = $credential
}
context 'Default parameters' {
$userName = 'IUser'
it 'creates the user with the first choice username' {
Get-ADUser @commonAdParams -Filter "Name -eq '$userName'"... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Simplify automation of common file transfer tasks for secure business partner integration/Demo/Convert-AzureSQLTableToXml.ps1 | Convert-AzureSQLTableToXml.ps1 | #Requires -Module SQLPS -RunAsAdministrator
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$OutputFilePath,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$ServerInstance,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Database,
... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Simplify automation of common file transfer tasks for secure business partner integration/Demo/Install-DemoPrereqs.ps1 | Install-DemoPrereqs.ps1 | ## For the demonstration to work correctly several pieces of software need to be loaded onto the MOVEit Central server
## to work properly. This script will download and install all of them.
#region Download and install all prereqs
## All required installers and the URLs they are located at
$files = [ordered]@... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Ipswitch - Simplify automation of common file transfer tasks for secure business partner integration/Demo/demo.ps1 | demo.ps1 | <#
This is a demonstration script used for the IPswitch MOVEit webinar. It is not meant to be used
in your environment directly but is provided as-is to show you examples of how to execute the script
we're demonstrating.
#>
#region Demo setup
$demoFolder = 'C:\IpSwitchDemo'
#endregion
## Show the prere... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Technofocus - PowerShell DSC Webinars/scripts/master-deployment-script.ps1 | master-deployment-script.ps1 | <#
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Technofocus - PowerShell DSC Webinars/scripts/SQL/ProvisionSQL.ps1 | ProvisionSQL.ps1 | <#
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
PowerShellCorpus/Github/adbertram_Session-Content/Webinars/Technofocus - PowerShell DSC Webinars/scripts/SQL/ProvisionSqlVm.ps1 | ProvisionSqlVm.ps1 | <#
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.