Gary's $this and that about PowerShell

I am a Microsoft Senior Premier Field Engineer based out of Atlanta, GA. My focus is Powershell. This blog is mainly to share interesting Powershell script samples.

Test Post to See if Code Paste From ISE Looks Okay

Test Post to See if Code Paste From ISE Looks Okay

  • Comments 1
  • Likes

 

This just a test post to see how well I can get code from ISE to look good on the blog, almost like a screen shot, but not actually be a screen shot, be totally copy and pastable.

PS> Get-Command -Verb Get | Format-Wide -Column 4

Get-ProvisionedA... Get-AppBackgroun... Get-AppxLastError   Get-AppxLog       
Get-AssignedAccess  Get-BCClientConf... Get-BCContentSer... Get-BCDataCache   
Get-BCDataCacheE... Get-BCHashCache     Get-BCHostedCach... Get-BCNetworkCon...
Get-BCStatus        Get-BitLockerVolume Get-ClusteredSch... Get-DAClientExpe...
Get-DAConnection... Get-DAEntryPoint... Get-Disk            Get-DiskImage     
Get-DnsClient       Get-DnsClientCache  Get-DnsClientGlo... Get-DnsClientNrp...
Get-DnsClientNrp... Get-DnsClientNrp... Get-DnsClientSer... Get-DscConfigura...
Get-DscLocalConf... Get-DscResource     Get-Dtc             Get-DtcAdvancedH...
Get-DtcAdvancedS... Get-DtcClusterDe... Get-DtcClusterTM... Get-DtcDefault    
Get-DtcLog          Get-DtcNetworkSe... Get-DtcTransaction  Get-DtcTransacti...
Get-DtcTransacti... Get-DtcTransacti... Get-FileHash        Get-FileIntegrity 
Get-FileStorageTier Get-InitiatorId     Get-InitiatorPort   Get-IscsiConnection
Get-IscsiSession    Get-IscsiTarget     Get-IscsiTargetP... Get-IseSnippet    
Get-LogProperties   Get-MaskingSet      Get-MMAgent         Get-MpComputerSt...
Get-MpPreference    Get-MpThreat        Get-MpThreatCatalog Get-MpThreatDete...
Get-NCSIPolicyCo... Get-Net6to4Confi... Get-NetAdapter      Get-NetAdapterAd...
Get-NetAdapterBi... Get-NetAdapterCh... Get-NetAdapterEn... Get-NetAdapterHa...
Get-NetAdapterIP... Get-NetAdapterLso   Get-NetAdapterPo... Get-NetAdapterQos 
Get-NetAdapterRdma  Get-NetAdapterRsc   Get-NetAdapterRss   Get-NetAdapterSriov
Get-NetAdapterSr... Get-NetAdapterSt... Get-NetAdapterVmq   Get-NetAdapterVm...
Get-NetAdapterVPort Get-NetCompartment  Get-NetConnectio... Get-NetDnsTransi...
Get-NetDnsTransi... Get-NetEventNetw... Get-NetEventPack... Get-NetEventProv...
Get-NetEventSession Get-NetEventVmNe... Get-NetEventVmSw... Get-NetFirewallA...
Get-NetFirewallA... Get-NetFirewallI... Get-NetFirewallI... Get-NetFirewallP...
Get-NetFirewallP... Get-NetFirewallRule Get-NetFirewallS... Get-NetFirewallS...
Get-NetFirewallS... Get-NetIPAddress    Get-NetIPConfigu... Get-NetIPHttpsCo...
Get-NetIPHttpsState Get-NetIPInterface  Get-NetIPsecDosp... Get-NetIPsecMain...
Get-NetIPsecMain... Get-NetIPsecMain... Get-NetIPsecPhas... Get-NetIPsecPhas...
Get-NetIPsecQuic... Get-NetIPsecQuic... Get-NetIPsecRule    Get-NetIPv4Protocol
Get-NetIPv6Protocol Get-NetIsatapCon... Get-NetLbfoTeam     Get-NetLbfoTeamM...
Get-NetLbfoTeamNic  Get-NetNat          Get-NetNatExtern... Get-NetNatGlobal  
Get-NetNatSession   Get-NetNatStatic... Get-NetNatTransi... Get-NetNatTransi...
Get-NetNeighbor     Get-NetOffloadGl... Get-NetPrefixPolicy Get-NetQosPolicy  
Get-NetRoute        Get-NetSwitchTeam   Get-NetSwitchTea... Get-NetTCPConnec...
Get-NetTCPSetting   Get-NetTeredoCon... Get-NetTeredoState  Get-NetTransport...
Get-NetUDPEndpoint  Get-NetUDPSetting   Get-NetVirtualiz... Get-NetVirtualiz...
Get-NetVirtualiz... Get-NetVirtualiz... Get-NetVirtualiz... Get-OdbcDriver    
Get-OdbcDsn         Get-OdbcPerfCounter Get-OffloadDataT... Get-Partition     
Get-PartitionSup... Get-PcsvDevice      Get-PhysicalDisk    Get-PrintConfigu...
Get-Printer         Get-PrinterDriver   Get-PrinterPort     Get-PrinterProperty
Get-PrintJob        Get-ResiliencySe... Get-ScheduledTask   Get-ScheduledTas...
Get-SmbBandWidth... Get-SmbClientCon... Get-SmbClientNet... Get-SmbConnection 
Get-SmbDelegation   Get-SmbMapping      Get-SmbMultichan... Get-SmbMultichan...
Get-SmbOpenFile     Get-SmbServerCon... Get-SmbServerNet... Get-SmbSession    
Get-SmbShare        Get-SmbShareAccess  Get-SmbWitnessCl... Get-StartApps     
Get-StorageEnclo... Get-StorageEnclo... Get-StorageJob      Get-StorageNode   
Get-StoragePool     Get-StorageProvider Get-StorageRelia... Get-StorageSetting
Get-StorageSubSy... Get-StorageTier     Get-StorageTierS... Get-SupportedClu...
Get-SupportedFil... Get-TargetPort      Get-TargetPortal    Get-Verb          
Get-VirtualDisk     Get-VirtualDiskS... Get-Volume          Get-VolumeCorrup...
Get-VolumeScrubP... Get-VpnConnection   Get-VpnConnectio... Get-WdacBidTrace  
Get-WindowsDevel... Get-xDscOperation   Get-Acl             Get-Alias         
Get-AppLockerFil... Get-AppLockerPolicy Get-AppxPackage     Get-AppxPackageM...
Get-AppxProvisio... Get-Authenticode... Get-BitsTransfer    Get-Certificate   
Get-CertificateA... Get-CertificateE... Get-CertificateN... Get-ChildItem     
Get-CimAssociate... Get-CimClass        Get-CimInstance     Get-CimSession    
Get-Command         Get-ComputerRest... Get-Content         Get-ControlPanel...
Get-Counter         Get-Credential      Get-Culture         Get-DAPolicyChange
Get-Date            Get-Event           Get-EventLog        Get-EventSubscriber
Get-ExecutionPolicy Get-FormatData      Get-Help            Get-History       
Get-Host            Get-HotFix          Get-Item            Get-ItemProperty  
Get-Job             Get-JobTrigger      Get-KdsConfigura... Get-KdsRootKey    
Get-Location        Get-Member          Get-Module          Get-PfxCertificate
Get-PfxData         Get-Process         Get-PSBreakpoint    Get-PSCallStack   
Get-PSDrive         Get-PSProvider      Get-PSSession       Get-PSSessionCon...
Get-PSSnapin        Get-Random          Get-ScheduledJob    Get-ScheduledJob...
Get-SecureBootPo... Get-SecureBootUEFI  Get-Service         Get-Tpm           
Get-TpmEndorseme... Get-TpmSupported... Get-TraceSource     Get-Transaction   
Get-Troubleshoot... Get-TypeData        Get-UICulture       Get-Unique        
Get-Variable        Get-VHD             Get-VM              Get-VMBios        
Get-VMComPort       Get-VMConnectAccess Get-VMDvdDrive      Get-VMFibreChann...
Get-VMFirmware      Get-VMFloppyDisk... Get-VMHardDiskDrive Get-VMHost        
Get-VMHostNumaNode  Get-VMHostNumaNo... Get-VMIdeController Get-VMIntegratio...
Get-VMMemory        Get-VMMigrationN... Get-VMNetworkAda... Get-VMNetworkAda...
Get-VMNetworkAda... Get-VMNetworkAda... Get-VmNetworkAda... Get-VMNetworkAda...
Get-VMNetworkAda... Get-VMProcessor     Get-VMRemoteFx3d... Get-VMRemoteFXPh...
Get-VMReplication   Get-VMReplicatio... Get-VMReplicatio... Get-VMResourcePool
Get-VMSan           Get-VMScsiContro... Get-VMSnapshot      Get-VMStoragePath 
Get-VMSwitch        Get-VMSwitchExte... Get-VMSwitchExte... Get-VMSwitchExte...
Get-VMSwitchExte... Get-VMSwitchExte... Get-VMSystemSwit... Get-VMSystemSwit...
Get-VMSystemSwit... Get-WIMBootEntry    Get-WinAcceptLan... Get-WinCultureFr...
Get-WinDefaultIn... Get-WindowsDriver   Get-WindowsEdition  Get-WindowsError...
Get-WindowsImage    Get-WindowsImage... Get-WindowsOptio... Get-WindowsPackage
Get-WindowsSearc... Get-WinEvent        Get-WinHomeLocation Get-WinLanguageB...
Get-WinSystemLocale Get-WinUILanguag... Get-WinUserLangu... Get-WmiObject     
Get-WSManCredSSP    Get-WSManInstance                                    

 

This is just testing different techniques for results and procedure efficiency.

 

PS> Get-Command -Verb Get | Format-Wide -Column 4

Get-ProvisionedA... Get-AppBackgroun... Get-AppxLastError   Get-AppxLog      
Get-AssignedAccess  Get-BCClientConf... Get-BCContentSer... Get-BCDataCache  
Get-BCDataCacheE... Get-BCHashCache     Get-BCHostedCach... Get-BCNetworkCon...
Get-BCStatus        Get-BitLockerVolume Get-ClusteredSch... Get-DAClientExpe...
Get-DAConnection... Get-DAEntryPoint... Get-Disk            Get-DiskImage     
Get-DnsClient       Get-DnsClientCache  Get-DnsClientGlo... Get-DnsClientNrp...
Get-DnsClientNrp... Get-DnsClientNrp... Get-DnsClientSer... Get-DscConfigura...
Get-DscLocalConf... Get-DscResource     Get-Dtc             Get-DtcAdvancedH...
Get-DtcAdvancedS... Get-DtcClusterDe... Get-DtcClusterTM... Get-DtcDefault    
Get-DtcLog          Get-DtcNetworkSe... Get-DtcTransaction  Get-DtcTransacti...
Get-DtcTransacti... Get-DtcTransacti... Get-FileHash        Get-FileIntegrity 
Get-FileStorageTier Get-InitiatorId     Get-InitiatorPort   Get-IscsiConnection

 

So far so good.

 

Add-Type -Path 'C:\Program Files (x86)\Blync\Microsoft.Lync.Model.dll'
Add-Type -Path 'C:\Program Files (x86)\Blync\BlyncDll.dll'
$Blync = New-Object BlyncDll.BlyncHid
$Blync.LookForBlyncDevices([ref]10) | Out-Null

$Client = [Microsoft.Lync.Model.LyncClient]::GetClient()

$ConvMgr = $Client.ConversationManager

Function MyStatus
{
    [Microsoft.Lync.Model.ContactAvailability]($Client.Self.Contact.GetContactInformation('Availability'))
}

Function Set-Blync
{
    Param
    (
        [parameter(Mandatory)]
        [ValidateSet('Blue','Cyan','Green','Magenta','Off','Red','White','Yellow')]
        [string]$Color
    )
    Switch ($color)
    {
       'Blue' {$Blync.PlayEffectHeadLightBlue() | Out-Null}
       'Cyan' {$Blync.PlayEffectHeadLightCyan() | Out-Null}
       'Green' {$Blync.PlayEffectHeadLightGreen() | Out-Null}
       'Magenta' {$Blync.PlayEffectHeadLightMagenta() | Out-Null}
       'Off' {$Blync.PlayEffectHeadLightOff() | Out-Null}
       'Red' {$Blync.PlayEffectHeadLightRed() | Out-Null}
       'White' {$Blync.PlayEffectHeadLightWhite() | Out-Null}
       'Yellow' {$Blync.PlayEffectHeadLightYellow() | Out-Null}
    }

}

Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment