nicefacts.de

Problemstellung: Daten sollen mittels “Invoke-SqlCmd” aus einer SQL-Server Datenbanke geholt werden. Sofern das “SqlServer”-Modul für die Powershell installiert ist, kann das auf bequeme Weise mit dem Commandlet “Invoke-SqlCmd” erfolgen. Beispielsweise so: Wie aus dem Code-Block ersichtlich, werden die Ergebnisdaten in der Variable “$result” gespeichert. Wenn man sich die Variable nun ausgeben lässt, dann könnte man […]

Weiterlesen

Somtimes you have to check the network connection state of the devices you want to connect to. Here are two little functions that might do what you want. Check a particular host if it is reachable by ICMP: This function returns “false” if the host is unreachable. Now the function that loops through a list […]

Weiterlesen

Today I took some first steps to control my Shelly 2.5 device. Actually, it’s about developing a class library for the Shellys in C # for my little smart home broker. In order to understand how the device works, an efficient script language such as Powershell is a good choice. Here is a small script […]

Weiterlesen

In order to check the speed of the disk storage connected to my SQL Server at defined intervals, I wrote a powershell wrapper for diskspd. If diskspd is not yet installed on the server to be checked, it will be downloaded from github and copied there. You can then persist the result in a database. […]

Weiterlesen

“Format strings” are used in the measures and other objects so that a predefined representation can be enforced for certain values. Problem: By default, in many languages ​​the “thousands” digit is shown with a “” (space). If another thousands separator is to be used, this can be achieved as described below. So that Analysis Services […]

Weiterlesen

Doing a “SELECT COUNT(*) FROM [TableName]” can be a long running task.Thanks to William Durkin for his example on Twitter to count the rows of a table using the system table “sys.partitions”. To use it in my daily busines, I have wrapped this up in an T-SQL inline function, like this one: This will return […]

Weiterlesen

Yesterday during lunch break I thought about building a binary clock with an ESP32. Since I don’t have a corresponding development environment on my device, I quickly prescribed the function for converting the time into a binary string in Powershell. The next step then is to convert this code into a C function. The simplest […]

Weiterlesen

Once upon a time in daily business there is only two things you have: A powershell and no internet / no media to install a appropriate module to query the Active Directory. Thank you god it`s LDAP-time. First we need to connect to the Active Directory. This is done via a DirectorySearcherObject (we want to […]

Weiterlesen