Hi together,
today i want to show you, how you can debug XAML GUIs created with PSGUI.
And to be honest – this is absolutely easy! You don´t think so? Take a look below.
Hi together,
today i want to show you, how you can debug XAML GUIs created with PSGUI.
And to be honest – this is absolutely easy! You don´t think so? Take a look below.
Hi together,
the date for the Technical Summit 2016 has been announced.
Save the date: 06.-08.12.2016 in Darmstadt
Further information:
Technical Summit 2016
Best regards,
David
Hi everyone,
SCCM 1606 with its new features has been announced:
In a short:
Do you like it?
Don´t forget to share thoughts via the UserVoice:
https://configurationmanager.uservoice.com/
Best regards,
David
Hi all,
i am using a german console with german words. Many of you know that we use “very special characters” also called umlauts: “ÄÜÖ”.
The interesting part is – if you try to use external tools as the following and they normally would return any values with umlauts this will not work out from Powershell; Let´s say for this example you created a shared directory named ‘ÄÜÖ’:
net.exe VIEW \\localhost\ /all
Here you would get something like this by using it in Powershell:
Freigabename Typ Verwendet als Kommentar ------------------------------------------------------------------------------- ADMIN$ Platte Remoteverwaltung Bilder Platte C$ Platte Standardfreigabe IPC$ IPC Remote-IPC print$ Platte Druckertreiber Users Platte Ž™š Platte Der Befehl wurde erfolgreich ausgefhrt.
This error is caused by not matching encodings. Therefore these have to be set previously for the console itself. But here comes again another tricky part. Till now – you would get an error by setting the consoles encoding without having used the cmd.exe out of powershell before, because the handle to the console has to be created previously. Therefore the way to get this to work would be like this:
cmd /c '' if ([Console]::OutputEncoding.CodePage -ne 852 ) { [Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding(852) } net.exe VIEW \\localhost\ /all #getting only the specific line net.exe VIEW \\localhost\ /all | Select-String 'Ö' net.exe VIEW \\localhost\ /all | Where-Object { $_ -like '*Ö*' }
With following result:
Freigabename Typ Verwendet als Kommentar ------------------------------------------------------------------------------- ADMIN$ Platte Remoteverwaltung Bilder Platte C$ Platte Standardfreigabe IPC$ IPC Remote-IPC print$ Platte Druckertreiber Users Platte ÄÖÜ Platte Der Befehl wurde erfolgreich ausgeführt.
I am pretty sure that german readers may need this information some time.
Best regards,
David
Hello together,
today i want to show you a simple but effective method to cleanup your HDD. This will also remove the installation data of previous installations and may prompt therefore for authorization. Run it with admin rights.
More information here
Set-Location 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\' foreach ($item in $(Get-ChildItem).PSPath) { if (-not (Get-ItemProperty -Path $item -Name 'StateFlags1234')) { New-ItemProperty -Path $item -Name 'StateFlags1234' -Value 2 } } cleanmgr.exe /sagerun:1234
Greetings,
David
Hello together,
today i want to share with you just two Powershell commands to reinstall Cortana or the Windows App Store if you are facing some problems with these:
Cortana:
Get-AppXPackage -Name Microsoft.Windows.Cortana | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
Windows App Store:
Get-AppXPackage *WindowsStore* -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Greetings,
David
Hello together,
here a simple smart function to show an open file dialog:
function Show-OpenFileDialog { <# .SYNOPSIS Shows up an open file dialog. .EXAMPLE Show-OpenFileDialog #> [CmdletBinding()] param ( [Parameter(Mandatory=$false, Position=0)] [System.String] $Title = 'Windows PowerShell', [Parameter(Mandatory=$false, Position=1)] [Object] $InitialDirectory = "$Home\Documents", [Parameter(Mandatory=$false, Position=2)] [System.String] $Filter = 'PowerShell-files|*.ps1|Everything|*.*' ) Add-Type -AssemblyName PresentationFramework $dialog = New-Object -TypeName Microsoft.Win32.OpenFileDialog $dialog.Title = $Title $dialog.InitialDirectory = $InitialDirectory $dialog.Filter = $Filter if ($dialog.ShowDialog()) { $dialog.FileName } else { Throw 'Nothing selected.' } } Show-OpenFileDialog
Have fun with it!
Greetings,
David
Hello together,
in this post i want to show you a very rare function attribute. It is called dynamicparam and as the name says it adds some features to create parameters dynamically when the user writes the execution function:
function Test-DynamicParam { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] $Count ) dynamicparam { $paramDictionary = New-Object -TypeName System.Management.Automation.RuntimeDefinedParameterDictionary foreach ($Property in (1..$Count)) { $attributes = New-Object System.Management.Automation.ParameterAttribute $attributes.ParameterSetName = '__AllParameterSets' $attributes.Mandatory = $false $attributeCollection = New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute] $attributeCollection.Add($attributes) $Name = "DynamicParam_$Property" $dynParam = New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter($Name, [int32], $attributeCollection) $paramDictionary.Add($Name, $dynParam) } $paramDictionary } begin {} process { "Entered: $Count" } end {} } Test-DynamicParam -Count 5
In this example the user enters the function name and the parameter $count. As you can see in the dynamicparam block now additional parameters are created. If you enter for example the number 5 – 5 additional parameters show up and can be given to the function.
So you can add or remove parameters depending on the parameters which the user entered which can be very powerful if you write very complex functions.
Give it a look
Greetings,
David
Hello together,
i have arrived today from a very good Powershell Training with Dr. Tobias Weltner, MVP. I have learned plenty new stuff and will blog lots of the new knowledge in the upcoming weeks.
The first thing i have to tell you – get a damn ISESteroids license! I did try it previously and liked it very much but had some scepsis to invest the money. After investigating 3 days the functions which all come along with the Steroids i have to say – its just amazing and a must have. Here are just some of them:
Try it by yourself and get a trial. Just take a look at http://www.powertheshell.com/
If you want to create good Powershell scripts this tool is just a must have at the moment.
Also a very important information for all powershell fanatics – take a look at the upcoming event Powershell Conference EU 2016 http://www.psconf.eu/
There will be some interesting speakers! Trust me!
Greetings,
David
Hello together,
today i want to show you a script of mine which removes Java from the computer. It makes no compromises and removes really everything of it. At least every relevant file and registry entry which i had found to that point.
But why? And why the hell so complicated?