About David das Neves

Hi. My name is David and I work as Premier Field Engineer at Microsoft Germany. My specialties are Dev, Powershell and Windows 10 Client and I am focused in client workshops and dev requests. Beside my work I write my own blog and speak at conferences on PS/Dev topics. Feel free to contact me.

LogFileParser with PowerShell

Hi all,

I am writing you from the PSConfAsia, where I had a session regarding PowerShell Classes with my LogFileParser. Take a look here, where I posted it officially:

https://blogs.msdn.microsoft.com/daviddasneves/2017/10/27/logfileparser-with-powershell/


All the best,

David das Neves

Premier Field Engineer, EMEA, Germany

Advertisements

Powershell Security at Enterprise Customers

TL;DR; (“too long; didn’t read”)

There are some people who don´t have the time to read the whole text – if you are familiar with the topic the text in bold includes the most important points and is just for you.

The most important points to enforce Powershell Security is to use the newest Versions (OS and Powershell), use whitelisting and enforcing the usage of the ConstrainedLanguageMode and establish a good rights structure with frequent centralized logging and validate all the new features coming with the new Windows 10 Versions. And now in more detail:

Continue reading

Storing Credentials securely

Hi together,

I have been asked many times how to store and use securely credentials / passwords in scripts. The simplest thing is just to create a credential on a computer and export it via Export-Clixml where you make use of the SecureString and the native Windows Data Protection API (DAPI), which is secure. (take a look here) But the downside is that you can decrypt the securestring only at the computer and with the user who encrypted it.

Therefore I want to show you this simple but neat way to achieve this task on all computers. For this we simply make use of certificates to encrypt and decrypt the passwords which you would preferably create with your own PKI and deploy with your management solution.

How does this look like? As simple as this:

Install-Module ProtectedData

#Testing purpose
New-SelfSignedCertificate -Subject PowershellSec -KeyUsage KeyEncipherment -CertStoreLocation Cert:\CurrentUser\My 

#Retrieving cert
$Cert = Get-ChildItem Cert:\CurrentUser\My | Where-Object {$_.Subject -like '*PowershellSec*'}

#Production
#$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Subject -like 'CN=PowerShell Automation*'}

# Encrypt password and store it in a file.
Protect-Data 'Password' -Certificate $Cert | Export-Clixml .\encrypted.xml

# Decrypt password from file within script.
$PasswordToUse = Unprotect-Data (Import-Clixml .\encrypted.xml) -Certificate $Cert 

$PasswordToUse

Alternatively you could also just use the Powershell built-in cmdlets:
Protect-CmsMessage and Unprotect-CmsMessage

Happy using!

David

PSConfEU 2017 – materials

PSConfEU.jpg

Hi there !

And again – a fantastic Powershell Conference managed by Tobias Weltner is now over!

The session materials can be found here:

https://github.com/psconfeu/2017

The video material can be found here:

powershell.video

Additionally to this I will create also some blog posts to my sessions. In one of these I will explain Powershell Security in depth! Stay tuned!

David

How important is scripting? Why Powershell?

Here we are – speaking about a topic, which all companies should have discussed and implemented years ago, but most of them didn´t. I will show you with some examples, why you should change your mind and even if you´re on the right train – there are still ways to improve.

Why scripting

Most of the companies think of scripting and automation as of cryptic hieroglyphics, which only the software developer gurus can handle. This is just a self protecting lie to be not forced to learn something new. Scripting (totally equally, which language you are using) is built up logically, which every IT-Administrator or IT- adept person can learn and master. But if you are still in doubt with this thesis you should take a look at the pros of scripting:

Continue reading