Get .NET Framework Version of an assembly (dll/exe) using PowerShell

i just had to find the required framework version for a compiled .NET assembly (just to make sure, that the selected Application Pool in IIS was set to the righte Framework Version).

——–

$fileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
 Filter = 'Assemblies (*.dll & *.exe)|*.dll'
 MultiSelect = $true}
 [void]$fileBrowser.ShowDialog()
 $files = $fileBrowser.FileNames
  
 foreach($file in $files)
 {
 $version = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($file).ImageRuntimeVersion;
 echo "$($file) is using Framework: $version"
 }
 

————–

Debugging Group Policy Processing

Group Policy Debug Log Settings

The below article has got information about enabling different debug loggings which are required for troubleshooting various Windows issues.

UserEnv Debug Logging

Userenv logging is useful when troubleshooting group Policy application related issues or User profile related issues.

Continue reading

Truncate Logfile in SQL Server

Using the code

Step 1. Copy/type the below given SQL.

Step 2. Change @DBName to < Database Name>, @DBName_log to <Log File Name>

Step 3. Execute the SQL.

ALTER DATABASE @DBName SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(@DBName_log, 1)
ALTER DATABASE @DBName SET RECOVERY FULL WITH NO_WAIT
GO  

In SQL Server data is stored using two physical files: 

  1. (.mdf)  extension  which contains the data. 
  2. (.ldf) extension which contains log.

Log file size increases very rapidly and depend on the operation performed on the data. After a long time period this file becomes too large. When log file is too large it takes time to perform some operations like ( attach , de-attach, backup, restore … etc ). 

How to configure Windows Time Synchronization (w32tm.exe) on a Windows Server 2008 R2 PDC

This article explains how to configure your Windows Server 2008 R2 Active Directory Primary Domain Controller to syncronise time with an external time source.

Note: In an active directory, all member computers will sync time with the PDC, so you only need to setup an external time source on the PDC.

Open an elevated command prompt and type the following:
Note: this is for switzerland. More NTP names can be found here: http://www.pool.ntp.org/en/

w32tm /config /manualpeerlist:"0.ch.pool.ntp.org 1.ch.pool.ntp.org 2.ch.pool.ntp.org 3.ch.pool.ntp.org" /syncfromflags:manual /reliable:yes /update
net stop w32time
net start w32time
w32tm /config /update
w32tm /resync
w32tm /resync

You can run W32tm /resync on member computers to sync time with the PDC.

Links

Configure the Windows Time service on the PDC emulator in the Forest Root Domain

How do I find orphaned computer objects in Active Directory using PowerShell?

How can I find all computer accounts in my Active Directory domain that have been inactive for x days using PowerShell?

This would give you all computer accounts that have no activity for the last 365 Days.

Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 365.00:00:00

This would sort it for you by lastlogondate.

Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 365.00:00:00 | Sort-Object lastlogondate | Ft name,lastlogondate -auto

This would give you disabled computer accounts.

Search-ADAccount -AccountDisabled -ComputersOnly 

Disabling Java Automatic Updates on a Terminal Server 32-bit and 64-bit Registry Redirection (Wow6432Node)

On a recently setup Windows Server 2008 R2 terminal server, Java was installed, and by default the JRE will enable automatic updates for all users. No daily users have administrative privileges, but all users are prompted to install updates. No users can actually install the available updates, nor can they disable the update check via the Control Panel.

Continue reading

Media added to DLNA shared library does not show up in Samsung Allshare Play

I’m streaming a lot of my media directly to my Samsung TV (Allshare). lately I added music to my Music Library in Microsoft Windows 8. The Library is shared using DLNA Protocol. For some reason, the newly added media did not show up am my Samsung TV. I started playing around with the configuration of DLNA/Homegroup/Sharing and finally I realized (and that’s an assumption), that the whole sharing stuff, especially when it comes to indexing the media, is managed by Windows Media Player (WMP).

I started Windows Media Player and under Streaming I clicked on More Streaming Options

Combobox Show Devices On => choose All networks

Select the relevant Device and click on Customize.

Then uncheck “Use Default settings”
and then check “Make all my media available to this device.”

2013-03-17 11_23_31-Media streaming options

2013-03-17 11_23_31-Media streaming options

Finally my newly added media has shown up in Allshare/Samsung TV.

Update a VMware ESX 4.1 Host

To scan for updates

esxupdate -m https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vmw-ESXi-4.1.0-metadata.zip scan

Stage updates

esxupdate -m https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vmw-ESXi-4.1.0-metadata.zip stage

Enter Maintenance Mode

vim-cmd /hostsvc/maintenance_mode_enter

Apply updates

esxupdate -m https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vmw-ESXi-4.1.0-metadata.zip update

Exit Maintenance Mode

vim-cmd /hostsvc/maintenance_mode_exit

Finally Reboot

reboot

Powershell – Eventlog – List Events of last N days with specific source

Querying EventLog using PowerShell.

Count the number of occurences of Kerberos Entries in System Eventlog for the last 24 hours

(Get-EventLog -LogName System -Source Kerberos -After (Get-Date).AddDays(-1)).Count

output the all Kerberos entries in System Eventlog for the last 24 hours:

Get-EventLog -LogName System -Source Kerberos -After (Get-Date).AddDays(-1)

VMware – Working with Snapshots (orphaned, broken VMDK descriptor file etc.)

Snapshots created via API (NetApp SMVI, Equallogic’s Auto-Snapshot Manager/VMware Edition, VMware VCB or VDR) occasionally get stuck. If you find an orphaned snapshot (ie – it is not listed in the snapshot manager but you can’t change the size of a vmdk / the provisioned size grayed out, or you happen to notice a -delta file where there shouldn’t be one or your scheduled monitoring tasks report an issue here are some potential fixes. Logo_VMware

Continue reading