Thursday, September 27, 2012

Emptying the Recycle Bin for a specific user

Suppose you want to empty the recycle bin of a different user but you do not know his password and do not want to reset it or just do not want to login with his account for any reason.

First get the SID of this account, use PsGetSid from PsTools
Then put the SID in the script below and run it. (will not delete until you uncomment the delete lines)


Const strRecycle = "\\$Recycle.Bin\\" 'Windows 2008, for Win7 use: \\Recycler\\
Set objSWbemServices = GetObject _
    ("WinMgmts:Root\Cimv2")

Dim SIDs : SIDs = Array("S-1-5-21-4040636791-1997804162-1132720628-1008",_
   "S-1-5-21-4040636791-1997804162-1132720628-1014",_
   "S-1-5-21-4040636791-1997804162-1132720628-1018")


For Each sid In SIDs

    Set colDisks = objSWbemServices.ExecQuery _
        ("Select * From Win32_LogicalDisk " &  "Where DriveType = 3")

    For Each objDisk In colDisks
        Set colDeletedFiles = objSWbemServices.ExecQuery _
        ("Select * From Cim_DataFile Where Drive = '" _
        & objDisk.DeviceId _
        & "' And Path = '" & strRecycle & sid & "
\\' " _
        & "And Hidden = False")

        For Each objDeletedFile In colDeletedFiles
            WScript.Echo objDeletedFile.Name
            'objDeletedFile.Delete
        Next
       
        Set colDeletedFolders = objSWbemServices.ExecQuery _
        ("Select * From Win32_Directory Where Drive = '" _
        & objDisk.DeviceId _
        & "' And Path = '" & strRecycle & sid & "
\\' " _
        & "And Hidden = False")

        For Each objDeletedFolder In colDeletedFolders
            WScript.Echo objDeletedFolder.Name
            'objDeletedFolder.Delete
        Next

    Next
Next

Wednesday, September 26, 2012

Installing Windows Server 2012

So I received an evaluation DVD of Windows Server 2012 at the Microsoft Boot Camp event and finally got some time to try it out.
Windows Server 2012 has several enhancements to Hyper-V, failover clustering in addition to integration with Microsoft cloud services Windows Azure.

I created a new virtual machine in Hyper-V 2008 R2 and booted the iso image





Initially I got the following error, which turned out to be a corrupt image:

A media driver your computer needs is missing. This could be a DVD, USB or Hard disk driver. If you have a CD, DVD, or USB flash drive with the driver on it, please insert it now.

Note: If the installation media for Windows is in the DVD drive or on a USB drive, you can safely remove it for this step.


I got another good copy and proceeded

As you can see there is no Enterprise edition anymore. Windows Server 2012 comes in 2 editions both of which have the same features: Standard allows you to run 2 VMs and Data Center can run unlimited number of VMs.


I choose to perform a new clean installation, select the disk drive and continue 


The installation goes on as usual, reboots a couple of times then prompts for the Administrator password









While you type the new Administrator password, you get an eye button that shows the password if you click hold it


Now the setup is complete and the login screen appears


After you login, the Server Manager pops up. The user interface is similar to the Windows 8 Desktop


This default installation is using around 12GB of disk space and 600MB of memory


Similarly to Windows 8, the Start Menu has been replaced with the Start Screen. If you hover the cursor over the lower-left corner for a while you will see Start Screen launcher, click it and you get the Metro-style tiled Start Screen, and of course you could have just pressed the Win key



Right click on any empty space, a bottom bar will appear with an icon "All apps", if you click it more applications tiles will appear

Right click any tile and the bottom bar will appear with more choices

Click on Desktop to return back to the desktop.
2 other hot spots at the top and bottom right corners, hovering over them shows the Charms Bar


Click on Settings, you will get another menu with other options such as shutdown and restart


Tuesday, September 18, 2012

Excel Services Application event 2026

When trying to run any BI sample report in Project Server 2010, the report gets stuck on loading the following event is logged

Log Name:      Application
Source:        Microsoft-SharePoint Products-Excel Services Application
Date:          9/18/2012 12:01:23 PM
Event ID:      2026
Task Category: Excel Calculation Services
Level:         Warning
Keywords:     
User:         
Computer:     
Description:
An internal error occurred.
   at Microsoft.Office.Excel.Server.MossHost.MossHost.Microsoft.Office.Excel.Server.Host.IEwaHost.IsSecureConnection()
   at Microsoft.Office.Excel.WebUI.EwaCUIDataSource.EnsureDocument()
   at Microsoft.Web.CommandUI.CUIDataSource.RunQuery(UIQuery query)
   at Microsoft.Office.Excel.WebUI.EwaRibbon.QueryRibbonDataSource(CultureInfo uiCulture, String clientID, Boolean denormalizeImareUri)
   at Microsoft.Office.Excel.WebUI.EwaStringsHandler.ProcessRequest(HttpContext context)

This error occured because there was no site collection created at the root of the web application, creating a blank site collection fixed the problem.

Also a hotfix is available http://support.microsoft.com/kb/2596582

Monday, September 3, 2012

Rule "Network binding order" generated a warning

While installing an SQL failover cluster, the system checks generate this warning

Rule "Network binding order" generated a warning
The domain network is not the first bound network. This will cause domain operations to run slowly and can cause timeouts that result in failures. Use the Windows network advanced configuration to change the binding order.


First thing to check is the binding order from Network Connections -> Advanced -> Advanced Settings and place the domain network on top


If it was already on top then check for hidden NICs, see Finding and deleting non present devices in Windows Server

If that did not solve the problem either, then it is probably the Microsoft Failover Cluster Virtual Adapter. This happened to me when I configured the cluster while the domain network was not the top one.

Run this command to get the NICs IDs

wmic nicconfig get description, SettingID

Then place the domain NIC on top by editing the following registry key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Linkage\Bind

Sunday, September 2, 2012

Microsoft ACPI-Compliant Power Meter Device unsigned driver

Windows 2008 R2 cluster validation wizard reports a System Configuration warning about an unsigned driver: Microsoft ACPI-Compliant Power Meter Device. Driver Name: Value Not Found




The problem was missing files acpipmi.ini and acpipmi.pnf from the Windows\inf directory. It seems the files have been deleted after installing EMC PowerPath. So back them up before installing PowerPath or if you have already installed it copy them from another similar Windows 2008 R2 installation.

Cannot rename this connection. A connection with the name you specified already exists

If you replace a network card or move it to a different slot, the old one does not get deleted it only becomes a hidden device. This can happen also if you remove a network adapter from a virtual machine. So if you try to rename a connection to the name of that hidden one you will get this error message:


Error Renaming Connection
Cannot rename this connection. A connection with the name you specified already exists. Specify a different name.

To delete the hidden NIC, launch a command prompt and set this environment variable

set devmgr_show_nonpresent_devices=1

then run the device manager devmgmt.msc


From the view menu, check: Show hidden devices



under the network adapters, you will find more devices have appeared, remove the old NIC but DO NOT delete the driver unless you are sure you do not need it.

Now you can rename the connection.