Boot to VHD

boot to vhd — i always forget the commands!

thanks: http://www.johnpapa.net/bootoffmetal/

Shift+F10 in windows setup…

  1. I start by creating a new VHD on the metal where the OS will be installed. It allows me to choose a fixed size or expandable virtual disk file.The advantage of using fixed is that it will always consume X amount of space and be able to boot. Expandable VHDs take up much less space when not used, but they need to have room to expand when they are booted into. I generally use expandable.
    create vdisk file=c:\win7.vhd maximum=50000 type=expandable
  2. Now I select the VHD, attach to it, create a partition on it, and format it. Then I marked it as an active system drive and assigned it a drive letter.

    select vdisk file=c:\win7.vhd
    attach vdisk
    create part primary
    format fs=ntfs label=”Win7″ quick

    active

    assign

FIX: SSMS 2012 Object Explorer hangs when expanding Databases node on a server with many DBs

GOLDEN!

REPOST FROM:

http://connect.microsoft.com/SQLServer/feedback/details/768124/ssms-2012-object-explorer-hangs-when-expanding-databases-node-on-a-server-with-many-dbs

Posted by _rod_ on 11/2/2012 at 4:09 AM

 Found this workaround here. http://stackoverflow.com/questions/10970989/sql-server-management-studio-2012-hangs
Can confirm it has fixed the problem for me.
Content as follows:
I experienced this same problem: when accessing a remote server with the Object Explorer, SSMS would hang indefinitely. The Windows System Event Log would show DCOM error 10009 (“DCOM was unable to communicate with the computer MACHINE_NAME using any of the configured protocols.”).
The solution was to clear the MRU history and other settings from my profile. To do that:
Close any open instances of SSMS 2012     In Explorer, open “%AppData%\Microsoft\SQL Server Management Studio”     Rename the “11.0” folder to something else, like “11.0.old”     Open SSMS 2012
You’ll see that your MRU list has been cleared. You should then be able to re-enter your credentials and use SSMS as normal.
If everything works, you can delete the renamed folder. Otherwise, delete the new “11.0” folder that was created and rename the original one back to “11.0”.
I have no idea whether it’s actually the MRU list that’s causing this problem or if it’s some other profile data.
We were able to discover that SSMS is trying to make a DCOM connection over port 135 to the SQL Server (perhaps for SSIS, T-SQL Debugging, or something else). Our firewall was configured to block port 135. By opening the port in the firewall we were able to use SSMS (hence the reason it worked against local databases but not remote ones). Unfortunately, an open port 135 is an invitation for a lot of attacks, so that wasn’t a practical solution for us.

“Sideloading of apps is not enabled on this site” Publishing SharePoint App directly from VS2013

I was playing with VS2013, my SharePoint online site, and uploading an app w/o any intervention on the browser (and without SharePoint installed locally).  My first attempt yielded this error:

“Sideloading of apps is not enabled on this site” – SharePoint Online Development.

Through various searches found these steps (thanks http://blogs.msdn.com/b/kaevans/archive/2013/10/05/enabling-the-developer-site-collection-feature-in-sharepoint-online.aspx)
1) Install SharePoint Client Browser (http://spcb.codeplex.com/releases/view/114743)
2) Open SharePoint PowerShell from SP Client Browser
3) Run this script (activates the hidden Developer feature):

$ctx.Load($ctx.Site);
$ctx.ExecuteQuery();
$guid = [System.Guid]”e374875e-06b6-11e0-b0fa-57f5dfd72085″
$ctx.Site.Features.Add($guid,$true, Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery();

4) Publish right from VS

Error using “Open in Explorer” for SharePoint Sites

After some frustration with Office 365 “Open in Explorer” giving these unhelpful errors:

Your client does not support opening this list with Windows Explorer
We’re having a problem opening this location in File Explorer. Add this web site to your Trusted Sites list and try again.
We’re having a problem opening this location in File Explorer. To open with File Explorer, you’ll need to add this site to your Trusted Sites list and select the “Keep me signed in” check box when you sign in to the SharePoint Online site. For more information, see http://support.microsoft.com/kb/2629108.
I found a KB Article that has a hotfix to fix this issue:
Woo!

SQL Tables by Size

Get SQL Tables by Size

SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
(SUM(a.total_pages) – SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN
sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN
sys.schemas s ON t.schema_id = s.schema_id
WHERE
t.NAME NOT LIKE ‘dt%’
AND t.is_ms_shipped = 0
AND i.OBJECT_ID > 255
GROUP BY
t.Name, s.Name, p.Rows
ORDER BY
t.Name

Reference: http://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database

Sweet.

Quick & Dirty — setting up SQL Server Mirroring

on Primary and Failover servers:
create endpoint endpoint_mirroring
state=started
as tcp (listener_port = 7022)
for database_mirroring (role=partner);
go

on witness server:
create endpoint endpoint_mirroring
state=started
as tcp (listener_port = 7022)
for database_mirroring (role=witness);
go
make sure the SQL service account that is running has CONNECT permissions
make sure the ports are open (no firewall, etc…)

create backup of the main DB to be mirrored
restore it as WITH NORECOVERY on the mirror
on the primary, go to Tasks -> Mirror -> and configure the mirroring

If a certificate is wrong, or the service account does not have permissions it will
give a misleading network error saying it cant reach the host (“The server network address TCP://developer02.dev.com:7022 cannot be reached or does not exist”, Alter <dbname> failed). Check the event log for what the real error is.

The connection string for mirrors is:
SERVER=DEVELOPER;FAILOVERPARTNER=DEVELOPER02;network=dbmssocn

Apparently the dbmssocn makes it so that it automagically switches to the failover – I dunno.

If necessary, you can create a linked server that behaves normally even when failed-over.  I tried with a default SQL Native Client but it didn’t work. SQL OLEDB seemed to work.

Querying it from a linked server uses the following syntax:
select * from developer.sandbox.dbo.person

Bing bang boom.

Invoke-SQLCommand, Verbose logging — solution: Start-Transcript / Stop-Transcript

Recently I needed to log the output of the Invoke-SQLCommand cmdlet including print statements.  I did some digging and some people said that Verbose output cannot be logged in PowerShell v2.  This is true, however – you CAN use Start-Transcript / Stop-Transcript and it will log everything that is in the PowerShell session…

WIN!

Start-Transcript -path “deploy_db_transcript_$currentTimePrefix.txt”

.. power shell stuff ..

stop-transcript

 

Reference: http://technet.microsoft.com/en-us/magazine/ff687007.aspx