Skip to main content

Posts

Showing posts from 2011

How to make Hyper-V image running under VirtualBox

VirtualBox allows you to run 64-bit guests on Windows 7 (64-bit, of course). When I attached a Hyper-V VHD to VM in VIrtualBox it failed to start with the error message A problem has been detected and windows has been shut down to prevent damage to your computer. If this is the first time you’ve seen this stop error screen, restart your computer. If this screen appears again, follow these steps: Check for viruses on your computer. Remove any newly installed hard drives or hard drive controllers. Check your hard drive to make sure it is properly configured and terminated. Run CHKDSK /F to check for hard drive corruption, and then restart your computer. Technical information: *** STOP: 0x0000007B (0x80786b58, 0xC0000034, 0x00000000, 0x00000000) Google quickly unveiled a solution in Olly's blog http://ollysense.blogspot.com/2010/05/virtualbox-using-hyper-v-vhd-image.html (if this link becomes unavailable then all you need to do is to configure your VHD disk to be on IDE no

Collect Server Information with WMIC (OS, Disks, Partitions, Software, etc.)

I had to create a new test environment and to make it a true representation of the production one I had to install all the service packs, hot fixes, cumulative updates, etc. as in production. So I decided to collect all essential information. And the simplest way (for me) was to use WMIC. To collect information about OS: WMIC OS GET BuildNumber, Caption, CSDVersion, CSName, OSArchitecture, OSLanguage, ServicePackMajorVersion, ServicePackMinorVersion, SystemDirectory, TotalVisibleMemorySize, Version, WindowsDirectory about all installed software (and be patient because it takes a couple of minutes to complete) WMIC PRODUCT GET Caption,Version About Windows domains WMIC NTDOMAIN GET Caption, ClientSiteName, DCSiteName, DnsForestName, DomainCOntrollerAddress, DomainControllerName, DOmainName about disks WMIC DISKDRIVE GET BytesPerSector, Name, SerialNumber, Signature,Size about partitions WMIC PARTITION GET BlockSize,Bootable,Name,Size,StartingOffset installed

ETL for SharePoint

Microsoft has released on CodePlex a SharePoint adapter with demos ( http://sqlsrvintegrationsrv.codeplex.com/ ) The adapter uses public SharePoint Web services and have several features that enhance their performance and their ease of use: ·         -  Only the fields that you want are returned from SharePoint. ·         -  Large lists are not transferred all at once. They are paged in batches, with a configurable batch size. ·         -  Column type information from SharePoint is used for mapping to Integration Services data types ·         -  CAML queries can be added to the query to filter the rows to be returned. ·         -  Update and Delete operations from an Integration Services package are simple. ·         -  Important custom properties of the source and destination can be set by using Integration Services expressions. ·         -  Supports SQL Server 2005, 2008, 2008 R2, and later.  -    - Supports x64 and x86 Processors  The document can be found in  http://msdn.micros

How to check if the SQL Server uses "Instant File Initialization"

 Data and log files are first initialized by filling the files with zeros when you perform one of the following operations: Create a database. Add files, log or data, to an existing database. Increase the size of an existing file (including autogrow operations). Restore a database or filegroup. File initialization causes these operations to take longer. However, when data is written to the files for the first time, the operating system does not have to fill the files with zeros. Instant file initialization is only available if the SQL Server (MSSQLSERVER) service account has been granted SE_MANAGE_VOLUME_NAME . This permission is granted by adding service account to the  Perform Volume Maintenance Tasks  security policy (in GPEDIT.MSC).  Instant file initialization is not available when TDE is enabled. To check if the SQL service account has this permission granted, run the following script: EXEC sp_configure 'Show Advanced Options', 1 reconfigure; EXEC sp_config

Removing sIDHistory attribute

When using PowerShell Commands for Active Directory modifications on AD objects are scripted easily. But dealing with some properties (e.g., sIDHistory) requires a special approach. Let's say we need to clear the sIDHistory for the account TEST01 This account does have the sIDHistory attribute populated [PS] C:\>$user=Get-QADUser -SamAccountName TEST01  -IncludedProperties sidhistory [PS] C:\>$user.sIDHistory 0105000000000005150000002B012212B316AD0EEE04CFAD576F1600 If we want to clear an attribute like DisplayName we can use Set-QADUser and set the attribute to $null like this: [PS] C:\>Set-QADUser $user -ObjectAttributes @{DisplayName=$null} Name                    Type            DN ----                    ----            -- Test01,User             user            CN=Test01, User... or that [PS] C:\>Set-QADUser $user -ObjectAttributes @{DIsplayName=@{delete=$user.DisplayName}} Name                    Type            DN ----            

How to Schedule an Script with Exchange cmdlets

when I need to schedule a PS script or to run a PS script from a command line I create a batch file containing the following two lines: @echo off powershell -psconsolefile "C:\Program Files\Microsoft\Exchange  Server\bin\Exshell.psc1" -Command "&{%~dpn0.PS1}" The %~dpn0.PS1 expression refers to a file with the same file name ( %~n0 ) as the batch file, located on the same drive ( %~d0 ) and in the folder ( %~p ) as the batch file.  And it correctly handles spaces in the folder name (because of double quotes). Thus, if you need to schedule a PS script named MyScript.PS1 you need to create a CMD file named Myscript.CMD and place it into the same folder where the PS1 script resides. And that's it.

Move Old Files to an Archive Folder

I have a folders structure where I store my scripts, backups, documents as shown below The folders becomes cluttered with old versions of the files. So I decided to create a script that will move old files from each of the folders beneath the root one (e.g., C:\WP) to an archive sub-folder (if it exists at the particular level). So I decided to archive old files in the Backups, Exchange, and SharePoint folders. I created sub-folders called 'ARCHIVE' under each of those three folders as shown below And then I created the following batch file @ECHO OFF SETLOCAL SET ArchiveFolder=Archive SET OlderThan=2 SET Extensions=TXT CSV BAK LOG REM starts from the current folder  REM   [when it's a scheduled task this is configured as "START IN"] REM CD C:\WP SET debug=ECHO  SET LogFile="%~dpn0.LOG" FOR /F %%m in ('CD') Do SET StartDir=%%m %debug%.>>%LogFile% %debug%.>>%LogFile% %debug%.>>%LogFile% %debug%