Skip to main content

Posts

Showing posts from September, 2014

PowerShell get username and email

To get username and email in Active Directory accounts using PowerShell, can be done easily if AD Powershell Modules cmdlets is loaded on the system. Check out this link if PowerShell AD module is not loaded: http://mikepfeiffer.net/2010/01/how-to-install-the-active-directory-module-for-windows-powershell/ Codes below will get all user accounts in Active Directory. Code below will display Name, UserPrincipalName and EmailAddress. Get-ADUser -Filter * | FT Name,UserPrincipalName,EmailAddress -AutoSize Name is the user account complete name (First name, Surname). UPN or UserPrincipalName is the domain account name for logon purposes. Email Address the email account address set on the user account property. Code below will display UserName, Email Address and PasswordLastSet (if PasswordLastSet data is available it will be displayed) Get-ADUser -Properties * -Filter * | FT Name,EmailAddress,PasswordLastSet -AutoSize Display user ...

Insert watermark in excel 2010

Excel 2010 does not provide a native function to insert watermark unlike in Word. Word by default has a function on the Ribbon tab to insert a watermark. In Excel watermark can be done also using this method below. On the Ribbon tab click on “Insert”, then click on “Header & Footer”. On the small rectangle that will pop up after clicking “Header & Footer” type:     &[Picture] Type exactly as it shown “&[Picture]”,  when done typing click outside the small rectangle. Then an insert dialog box will appear choose from your PC any pictures you want as a watermark background. Please images below on how to insert a watermark background in “Excel 2010”. After selecting a picture to insert then the final result would be something like this: Image inserted as watermark: Screen shot of excel with the watermark background: Cheers.. hope it helps!!

Excel VBA Speak method

Microsoft has provided an Speech Object Library that can easily be referenced using   Excel VBA. To add a reference to Microsoft Speech Object Library on Excel. Open the Developer tab or press "ALT + F11". Or check out this link to open the developer tab: http://quickbytesstuff.blogspot.sg/2014/03/how-to-view-excel-macros.html On the VBA window, click on " Tools " and click on " References ". And add the "Microsoft Office Speech Object Library". See image below on how to add references in excel. If Microsoft Office Speech Object Library is not added, VBA will throw a Compile error, "User-defined type not defined". Once the reference has been added, create a new macro. Click on the modules folder, on the VBA project window and add the code below: Uncomment the line to test different voices. ==================================== Option Explicit Private V As SpeechLib.SpVoice ...

Excel automatic row numbering

Automatic row numbering is quite straight forward. Just type two consecutive numbers, even alphanumeric combination. Excel is smart enough to auto number or makes a pattern sequence to insert values on the rows. If there are hidden rows in excel and desired output is not to include hidden rows as part of auto numbering, then this method will not work. Then one option of course is to manually type the number or the values. But it would be much better to do it on one click. If you need a time waster then do it manually, but if urgency is required VBA will be a good option to automate the process. If there are hidden rows in excel, it will auto number but the hidden rows will also be included on the count. Link below Microsoft provided a VBA code on how to detect hidden rows. http://support.microsoft.com/kb/150363/en-us To tweak the code just a little bit then auto numbering with hidden rows will not be an issue. How the code wo...

Use Linux Grep in Bash Script

Grep is a useful command in Linux to filter desired strings or values or to match string pattern. Type: "man Grep" on Linux terminal window to dig more about Grep command. Script below is a simple way on how Grep can be used on a script. Script also shows and performs basic calculation to get desired number of days. Ls command in Linux is to list directory contents. If dealing with a large or huge data, Ls alone can't be a handy tool. So "Ls" command combined with "Grep" can be a good handy tool. For more complex scenario "RegEx" will come into play, but "RegEx" will be too much for a newbie. So mileage may vary using "RegEx". So it's better to start with Grep and get a hang of it and move to "RegEx" to gain more. Script below, will list files on a directory. All files on a directory which has a time stamp of yesterday's date from the current date. xMin...