This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FORMS_PLAN_E3 | |
| STREAM_O365_E3 | |
| Deskless | |
| FLOW_O365_P2 | |
| POWERAPPS_O365_P2 | |
| TEAMS1 | |
| PROJECTWORKMANAGEMENT | |
| SWAY | |
| INTUNE_O365 | |
| YAMMER_ENTERPRISE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .EXTERNALHELP PSCloudConnect-help.xml | |
| #> | |
| function Get-LAConnected { | |
| [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] | |
| Param | |
| ( | |
| [parameter(Position = 0, Mandatory = $true)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PS C:\scripts> Get-LAConnected lapcm -AzureADver2 | |
| VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\AzureAD\2.0.0.131\AzureAD.psd1'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADApplicationOwner'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADDeviceRegisteredOwner'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADDeviceRegisteredUser'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADDirectoryRoleMember'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADGroupMember'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADGroupOwner'. | |
| VERBOSE: Importing cmdlet 'Add-AzureADServicePrincipalOwner'. | |
| VERBOSE: Importing cmdlet 'Confirm-AzureADDomain'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $badname = gc "C:\scripts\test\files.csv" | |
| $oldname = gc "C:\scripts\test\filesNEW.csv" | |
| $oldname.Length | |
| $badname.Length | |
| for ($i = 0; $i -lt $badname.Length; $i++) { | |
| $bad = $badname[$i] | |
| $old = $oldname[$i] | |
| Rename-Item "c:\scripts\test\$bad" "c:\scripts\test\$old" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foreach ($comp in $computers) { | |
| New-PSSession -ComputerName $comp -Credential $Credential | |
| $TargetSess = (Get-PSSession -ComputerName $comp -Credential $Credential | where {$_.State -eq 'opened'}) | |
| $destination = "c:\scripts\R" | |
| Copy-Item \\source\R\* -Destination $destination -ToSession $TargetSess -Force | |
| $ScriptBlock = { | |
| cd "C:\scripts\R"; | |
| . .\Remove-PreviousOfficeInstalls.ps1 | |
| Remove-PreviousOfficeInstalls | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PS D:\scripts> $computers | % {$session = New-PSSession $_ ; invoke-command -scriptblock {Send-File -Source "D:\scripts\Generate_FilePath\OfficeProPlu | |
| s.msi" -Destination "C:\scripts\R\OfficeProPlus.msi" -Session $session}} | |
| PS D:\scripts> $computers | % {$session = New-PSSession $_ ; invoke-command -AsJob -scriptblock {Send-File -Source "D:\scripts\Generate_FilePath\Offi | |
| ceProPlus.msi" -Destination "C:\scripts\R\OfficeProPlus.msi" -Session $session}} | |
| Invoke-Command : Parameter set cannot be resolved using the specified named parameters. | |
| At line:1 char:47 | |
| + ... ession $_ ; invoke-command -AsJob -scriptblock {Send-File -Source "D ... | |
| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| + CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException | |
| + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $computers = "se-c-w7o13-3", "se-c-w10o10" | |
| $scriptblock = { | |
| $usession = $using:session | |
| D: | |
| cd D:\scripts | |
| . .\Send-File.ps1 | |
| Send-File -Source "\\source\msi\OfficeProPlus.msi" -Destination "C:\scripts\R\OfficeProPlus.msi" -Session $usession | |
| } | |
| $computers | % { | |
| $session = New-PSSession $_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $computers = "se-c-w7o13-3", "se-c-w10o10" | |
| $scriptblock = { | |
| $usession = $using:session | |
| D: | |
| cd D:\scripts | |
| . .\Send-File.ps1 | |
| Send-File -Source "\\source\msi\OfficeProPlus.msi" -Destination "C:\scripts\R\OfficeProPlus.msi" -Session $usession | |
| } | |
| $computers | % { | |
| $session = New-PSSession $_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-Events { | |
| <# | |
| .SYNOPSIS | |
| .DESCRIPTION | |
| .EXAMPLE | |
| get-content ./hostnames.txt | Get-Event -EventID 1034 -NumberofNewestIDs 100 | |
| #> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Send-FileAsJob { | |
| <# | |
| .SYNOPSIS | |
| Function to copy files and directories recursively | |
| Uses PowerShell jobs to help parallelize tasks | |
| .DESCRIPTION | |
| Function to copy directories and files recursively | |
| Also can be used to copy a file or file(s) | |
| When the destination is a UNC path the computers being passed at the pipeline can be passed to %C in destination path (%C is case sensitive) |