Category Archives: Scripting & programming

Somthing about Powershell, VB Script, C#, VB.NET

C#: Get description attribute from an enum value

Hi,

in this post I will show how to read a description attribute of an enum value by reflection. Let us assume we have a enum linke this

public enum MetalBands {
	[DescriptionAttribute("This is Metallica from CA")]
	Metallica,
	[DescriptionAttribute("This is Slayer from CA")]
	Slayer,
	[DescriptionAttribute("This is Overkill from NY")]
	Overkill
};

Continue reading C#: Get description attribute from an enum value

Advertisment to support michlstechblog.info

Powershell: Export a Excel Worksheet as csv file

Hi,

with a few lines Powershell code it is possible to export a Excel Workbook as a csv file.
Define your excel list

$sExcelFile="D:\temp\ExcelFile.xlsx"
$sCSVFile="D:\temp\list.csv"

Open Excel using DCOM
Continue reading Powershell: Export a Excel Worksheet as csv file

Windows: Equivalent to linux time command

Hi,

the time command in Windows gets or sets the system time. If you need an equivalent to the linux time command – which measure the execution time of a given command – you can use the powershell commandlet Measure-Command. Limitation is that only the time can measure how long the command execution runs, not splited into user, system and realtime.
Continue reading Windows: Equivalent to linux time command

Powershell: List members of an Active Directory Group

Hi,

here are the code snippets to list all members of an Active Directory Group.

Some constants

# Define LDAP search root, the Global catalog of the domain
$sLDAPSearchRoot="LDAP://yourDomain.com:3268"
# The Groupname to looking for
$sGroupName="USR_GRP_IN_AD"

Continue reading Powershell: List members of an Active Directory Group

Windows: Convert formatted text in clipboard to plain text

Hi,

when you often have to copy some text between HTML/Browser pages, browser based content management systems, Office Documents and terminal emulators you know the problem: Text from browsers and office documents also contains format attributes like font size, fonts etc. which causes an unexpected layout or format.

For example, if you copy a text from LibreOffice to wordpress(Yes of course, you could paste the test  into wordpress by using the “paste plain text” toolbar buttons. But this is one step more and I prefer Ctrl V Ctrl C for copy and paste).
Continue reading Windows: Convert formatted text in clipboard to plain text