header image

Archive for December, 2019

VScode improvement

Posted by: | December 31, 2019 Comments Off on VScode improvement |

VScode is the recommended editor for PowerShell Core as its multi-platform. Personally, I’ve preferred the Windows PowerShell ISE as its more closely aligned with the code I create and the work I do. The latest VScode improvement means I’m beginning to question that stance.   The latest version of VScode has buttons to run the […]

under: PowerShell

Clear the trusted host list

Posted by: | December 31, 2019 Comments Off on Clear the trusted host list |

The final option in administering the trusted host list is to clear the entire list. The following function will clear the trusted host list function clear-trustedhost { [CmdletBinding()] param ( [string]$computername = $env:COMPUTERNAME ) if (Test-Connection -ComputerName $computername -Quiet -Count 1) { Set-WSManInstance -ResourceURI winrm/config/client -ComputerName $computername -ValueSet @{TrustedHosts = “”} } else { Write-Warning […]

under: PowerShell

Remove a trusted host

Posted by: | December 30, 2019 Comments Off on Remove a trusted host |

Continuing our collection of routines to manage the trusted hosts this time we’ll look at how to remove a trusted host function remove-trustedhost { [CmdletBinding()] param ( [string]$trustedhost, [string]$computername = $env:COMPUTERNAME ) if (Test-Connection -ComputerName $computername -Quiet -Count 1) { $th = Get-WSManInstance -ResourceURI winrm/config/client -ComputerName $computername | Select-Object -ExpandProperty TrustedHosts if ($th) { $ths […]

under: PowerShell

Add a trusted host

Posted by: | December 29, 2019 Comments Off on Add a trusted host |

Last time I showed how to read the trusted host list – this is how you add a trusted host function add-trustedhost { [CmdletBinding()] param ( [string]$trustedhost, [string]$computername = $env:COMPUTERNAME ) if (Test-Connection -ComputerName $computername -Quiet -Count 1) { $th = Get-WSManInstance -ResourceURI winrm/config/client -ComputerName $computername | Select-Object -ExpandProperty TrustedHosts if ($th) { $newth = […]

under: PowerShell

Trusted hosts

Posted by: | December 28, 2019 Comments Off on Trusted hosts |

You can use trusted hosts in WSMAN based PowerShell remoting to authenticate computers where Kerberos isn’t available. The WSMAN configuration is available through the WSMAN PowerShell drive or you can use the WSMANInstance cmdlets – available in Windows PowerShell v5.1, PowerShell 6.2 (Seem to have come back in at PowerShell v6.1) or PowerShell v7 function […]

under: PowerShell

Keep it Simple

Posted by: | December 28, 2019 Comments Off on Keep it Simple |

One of the principles I’ve always tried to stick with when writing code – in PowerShell or any other language – is Keep it Simple.   Keeping code simple makes it easier to understand, easier to debug and easier to maintain. My definition of simple code may not be the same as yours but by […]

under: PowerShell

What do you use PowerShell for?

Posted by: | December 27, 2019 Comments Off on What do you use PowerShell for? |

What do you use PowerShell for?   Personally, I’ve always used it as a tool to automate the administration of Windows systems. I’ve created and managed systems. Managed the OS and file system. Administered Exchange, Active Directory and SQL Server amongst other tasks.   I’ve also used PowerShell for a wide variety of other tasks […]

under: PowerShell

Season’s Greetings

Posted by: | December 24, 2019 Comments Off on Season’s Greetings |

Season’s Greetings from PowerShell (77,101,114,114,121,32,67,104,114,105,115,116,109,97,115,32,97,110,100,32,97,32,72,97,112,112,121,32,78,101,119,32,89,101,97,114 | foreach {[char][byte]$psitem}) -join ”

under: PowerShell

PowerShell remoting

Posted by: | December 24, 2019 Comments Off on PowerShell remoting |

PowerShell remoting must be every administrators favourite feature. The fact that you can connect to to multiple machines and get your tasks done just makes life so much easier.   PowerShell remoting originally appeared in PowerShell v2. In v1 Get-WMIObject was the only cmdlet capable of connecting to a remote machine. Remoting used WSMAN for […]

under: PowerShell

PowerShell cmdlets

Posted by: | December 19, 2019 Comments Off on PowerShell cmdlets |

Continuing my series of the features in PowerShell we shouldn’t forget – we get to PowerShell cmdlets.   The PowerShell cmdlet ecosystem has grown from the 137 cmdlets in PowerShell v1 to who knows how many are available to windows PowerShell v5.1, PowerShell v6.x and PowerShell v7 – certainly in the thousands.   A cmdlet […]

under: PowerShell

Older Posts »

Categories