Security Concern: Alternative to extended stored procedures on Microsoft SQL Server
With this in mind, as far as SQL Server Agent jobs are concerned, I’d suggest creating a Powershell job step:
Bear in mind this requires a specific kind of error handling. By default the ErrorActionPreference is set to Continue, and this has implications on how errors bubble up to the SQL Server Job Server. If you run a Windows PowerShell command as a SQL Server Agent job and there are no syntax errors but the command produces an error, the SQL Server Agent job will report success. If you want an error condition to halt execution of a SQL Server Agent job or to produce an error, you'll need to add some error handling. To bubble up Windows PowerShell errors to SQL Server Agent, you'll need to set your $ErrorActionPreference = "Stop". You can check that out here.
For the processing task which are a hybrid of data manipulation and other external system related tasks I’d suggest the development of Powershell scripts that use SQL Server Management Objects (SMO) which is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server.
Sure, you might say that this suggestion doesn’t help from learning to code, but this is an inevitable goal every SQL Server DBA must have as the future might have projects where the projects might have a server core platform. What then?
So why not kill two rabbits with one stone and learn your Powershell and SMO, it quite seems the way to go. For starters, this might help.
By coincidence, as I'm writing this post, this editorial from SQLServer Central came out. What are the odds of that?
Happy coding!
Photo Credit: baboon™ via Compfight cc
Installing .NET 3.5 on Windows 8
While installing a third party software on my laptop running Microsoft Windows 8, the operating system informed me that it required to download and install the .NET Framework 3.5. After my consent, it failed to download the package to install. I thought nothing of it and left the task for later.
However, this began to be a recurring episode. Even the very .NET Framework setup program would fail. While installing Windows Live Essentials (I really love Live Writer), the error happened again:
The error code 0x800F0906 wasn’t something I knew about and the support link is an awful article which suggest an over the top work around.
So I tried some common sense and analogy. If you’re used to administering Windows 2008 Servers you should know that the Microsoft .NET 3.5 Framework is installed from the feature selection on the add/remove role operation for the Application Server. Windows 7 itself has features that are essential for system administration like Telnet, and yet you have to add them manually.
With these aspects in mind I went to the Windows 8 Start screen and typed “Features”. Afterwards I selected “Settings” in the search bar and the desired option appeared, called “Programs and Features”:
From the list, you just choose the .NET Framework 3.5 and choose to download from Windows Update:
Now just wait for the installation to complete:
I was all set to go. You should be too .
SQL Server Free Tools
But like most database management tools, it lacks a more automated support for some recurrent tasks that should be easier to perform.A developer will certainly wish for automatic generation of CRUD statements for a given database table. And a database administrator would surely like to run a maintenance script on all databases where it should be executed, all servers at once.
If these kind of enhancements are on your wishlist, be sure to check out the SSMS Tool pack. It’s a free add-in for SQL Server Management Studio with a great list of enhancements:
- Execution Plan Analyzer
- SQL Snippets
- Window Connection Coloring
- Tab Sessions, Window Content History, Query Execution History and Current Window History
- Format SQL
- Search Table, View or Database Data
- Run one script on multiple databases
- Copy execution plan bitmaps to clipboard or file
- Search Results in Grid Mode
- Generate Insert statements from resultsets, tables or databases
- Regions and Debug sections
- Running custom scripts from Object Explorer
- CRUD (Create, Read, Update, Delete) stored procedure generation
- New query template
Free ebook: Introducing Windows Server 2012
Windows Server 2012is designed for the cloud from the ground up and provides a foundation for building both public and private cloud solutions to enable businesses to take advantage of the many benefits of cloud computing. Keeping that in mind, this book states that Windows Server 2012 is probably the most significant release of the Windows Server platform ever.
This book is presented as a “first look” based on the public beta release of Windows Server 2012 and is intended to help IT professionals familiarize themselves with the capabilities of the new platform. Below you can find the table of contents on this book:
Table of Contents
Chapter 1 The business need for Windows Server 2012The rationale behind cloud computing Making the transition
Technical requirements for successful cloud computing
Four ways Windows Server 2012 delivers value for cloud computing Foundation for building your private cloud
Chapter 2 Foundation for building your private cloud
A complete virtualization platform
Increase scalability and performance Business continuity for virtualized workloads
Chapter 3 Highly available, easy-to-manage multi-server platform
Continuous availability
Cost efficiency
Management efficiency
Chapter 4 Deploy web applications on premises and in the cloud
Scalable and elastic web platform
Support for open standards
Chapter 5 Enabling the modern workstyle
Access virtually anywhere, from any device
Full Windows experience
Enhanced security and compliance
The book can be downloaded in various formats from this official MSDN web page.
Happy reading!
Error when starting a fresh install of Umbraco CMS
This was disappointing, especially because we're talking about a fresh install and I hadn't fiddled with it yet.
After some scouring on the Web taking into account Umbraco was complaining about the umbraco.cms.businesslogic.macro.MacroModel, I found the solution was to edit the starter kit template so it wouldn't use macros that were not installed. So, first step, go to the Umbraco administration site and navigate to the "Developer" screen:
Expand the "Macros" node on the tree and check what macros you've got installed and take note of their aliases:
Sharepoint 2010 BCS Login failed for user "NT AUTHORITY\ANONYMOUS LOGON"
- Create the external Content Type
- Create the content type CRUD operations
- Define the identifier field
- Define a list length threshold
- Create the associated list and forms
- Set the meta data store permissions and object permissions according to planned
Not being able to solve this issue, I tried to configure the data source to use the credential running the BCS service which had full access to the data. When trying to save the object on Sharepoint Designer, I got the following error:
To make the desired change, you should run the following commands on the Sharepoint Administration Powershell prompt:
PS C:\Users\SPSadmin> Get-SPServiceApplication DisplayName TypeName Id ----------- -------- -- ... User Profile Serv... User Profile Serv... 2303b602-0d87-46b8-a684-e6a884dd1071 ... PS C:\Users\SPSadmin> $bdc = Get-SPServiceApplication -id 2303b602-0d87-46b8-a684-e6a884dd1071 PS C:\Users\SPSadmin> $bdc.RevertToSelfAllowed = $true PS C:\Users\SPSadmin> $bdc.Update()
Afterwards, restart the Business Data Connectivity Service and the list should be working fine.
For this and other Sharepoint 2010 issues I strongly recommend reading Professional SharePoint 2010 Administration
MS-SQL–Get all tables with a given column name
USE [your database name]
GO
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%given column name%'
ORDER BY schema_name, table_name;
HTH.
Microsoft Team Foundation Server - Antivirus folder rule out
The bad news are that if a fine tuning and folder rule out policy is not in place, the database servers and application server will have their performance seriously compromised. The On-access scan feature will perform its own DoS attack on the hosts.
According to the server role, the adequate folder need to be ruled out from the malware scanning engine.On this specific post, you can find a lead on what folders should be ruled out on a Microsoft Team Foundation Server.
On the database server (MS-SQL) you should obviously rule out the path to the data volumes (.mdf and .ldf files) supporting the TFS.
On the actual TFS server, the following folder should be ruled out:
- C:\Program Files\Microsoft Team Foundation Server 2010
Test open network ports using Powershell
Commonly this is performed using a command line and issuing a “telnet” connection to the desired host on a given port. This is nice when you have a single machine with a couple of connections to be tested.
When the scenario involves tens of machines with different network connection requisites between each other, the telnet procedure is a very slow process, being the typical test cycle:
- Open command prompt.
- Issue telnet to a given host and port.
- On success, close window and return to step 1.
- On failure, wait for timeout.
- Authorize the network port that failed
- Repeat step 2.
- On success go to step 1.
- Open command prompt.
- Issue command or script to test all destination hosts on desired ports.
- Check status and authorize failed network traffic.
- Repeat step 2 and check for success.
To surpass these annoyances, one can use this Powershell function “Test-Port”, available from the Microsoft Technet Script Center Repository.
The syntax of the base usage is really simple. To test conecctivity to this site:
Test-port -computer blog.ozzie.eu -port 80
To address the fact of the ever growing shared network resources to be tested, an Excel spreadsheet can be used to generate the test battery script. Here’s an example you can view and download:
Afterwards, you just copy/paste the powershell column to a .ps1 file. I’ve also included a regular command prompt test column.
HTH.
Windows Monitoring – Codeplex
This project is meant to provide programmers with a set of reusable classes, gathered into one assembly, to develop custom system monitoring consoles for windows server systems.
The base set provides classes with methods to check:
- Network ping
- HTTP server running
- FTP server running
- Disk space on system hard drive
- Database availability
I took the dust off the Codeplex account, logged in using Visual Studio 2010 together with Team Explorer and migrated the code from .NET 2.0 onto 4.0.
The update projects and source code can be browsed and downloaded. If you don’t have Visual Studio, but some other IDE, you can download the assembly on the recommended release and use the tester source code as a usage example.
Happy coding!
Your backup is from a different version of Microsoft SharePointFoundation
Restore-SPSite : Your backup is from a different version of
Microsoft SharePoint Foundation and cannot be restored to a
server running the current version. The backup file should be
restored to a server with version '4.0.145.0' or later.After comparing the patch level on both farms, a missing security update was identified on the live farm. Having multiple applications hosted on the farm, the update roll-out was not an option.
So one of my colleagues found that the old school "stsadm" command allows the backup and restore of Sharepoint sites without checking the build number on the farm.
The solution was to use the following commands:
- On the Q&A server, open a command prompt and enter "cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>"
- Execute the following command:
STSADM.EXE -o backup -url http://server/site -filename backup.dat
- Copy the resulting file to the live farm.
- On the live farm, open a command prompt and enter "cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>"
- Execute the following command:
STSADM.EXE -o restore -url http://server/site -filename backup.dat -overwrite
- Open the desired URL and check for your site's correct update.
Thanks to Nelson!
Installing Sharepoint 2010 on server without Internet acess
The solution is to download the pre-requisites software and copy them to the server. Here's a list for future reference:
- Microsoft SQL Server 2008 Native Client
- Microsoft Sync Framework Runtime v1.0
- Windows Identity Foundation
- Microsoft Chart Controls for Microsoft .NET Framework 3.5
- Microsoft SQL Server 2008 Analysis Services ADOMD.NET
- Hotfix for Microsoft Windows - KB976462 (didn't need it, was already installed)
- Windows language packs
- Sharepoint language (Foundation and Server)
- Security Updates
For this and other Sharepoint 2010 issues I strongly recommend reading Professional SharePoint 2010 Administration
Requested registry access is not allowed
The origin of the error was the attempt the service made to write on the Event Log.
One of the changes we had made to the application was the application pool identity. It was running on Classic mode with a given domain account and we re-configured it to run on integrated mode with the application pool identity.
To grant rights to a given user account for writing on the Event Log, you should perform the steps to edit the registry described here:
- Find key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog"
- Right-click and choose "Permissions".
- Put in the desired account
The catch is that the application pool is running with the Application Pool Identity Account. This is a Windows user account called "IIS APPPOOL\AppPoolName", which is created when the Application Pool is created, where AppPoolName is the name of the Application Pool.
On the permission dialog, search the local host for the "IIS APPPOOL\AppPoolName" replacing "AppPoolName" for your custom given name.
After that, the Web service worked fine.
Chrome browser slow on corporate network
Having it installed on the corporate office workstation, I noticed it was much slower and taking forever to load some really simple stuff.
After some research on Google, I found and tested successfully the following scenario:
- The proxy server is automatically configured through network policies.
- Configuring the proxy server directly, without automatic configuration, restores Chrome to its full speed.
- Start/Run the "Regedit" tool
- Find the key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
- Set the ProxyEnable entry to "1"
- Create a "ProxyServer" String entry and set it to «your proxy server address»:«port used» (ex: 10.0.211.11:8080)
- Finally, go to your browser's LAN settings and disable automatic configuration
Posting SOAP request from Windows Powershell
Following the post about Invoke-Web-Request, I'll show how to achieve the same task using Windows Powershell v3 CTP 1.
The first step is to build a sample SOAP request and save it on a text file, maybe called “soap.txt”. For the sake of this example I saved it on a temporary folder "C:\Temp"
Afterwards, open a powershell command prompt window and type this in:
Invoke-WebRequest http://[your web service endpoint address] -Method Post -ContentType "text/xml" -InFile C:\Temp\soap.txt -OutFile c:\Temp\soapRes.txt
The command has the following parameters:
- method: indicating the request should be sent using HTTP POST
- content type: stating the request is an XML message
- input file: the SOAP request text file
- output file: the name and path for saving the SOAP response
After execution, the resulting SOAP response is saved on the temporary folder under the name "soapresult.txt".
Cool!
Windows Powershell V3 includes command like wget/curl
Included on this release of powershell comes a command I've personally been missing for ages. A command to get or just test a given URL address. The is called:
Invoke-WebRequest
A simple example of the command usage would be the get this blog's home page into a single text file:
Invoke-WebRequest http://rambletech.wordpress.com/ -OutFile c:\temp\blog.txt
Another example, more complex, would be to get this blogs RSS feed and parse it:
([xml](Invoke-WebRequest http://rambletech.wordpress.com/rss).content).rss.channel.item | Select Title, Link
To download the Windows Management Framework 3.0 CTP 1 visit this address from Microsoft.
Happy programming :)
Boot Windows 7 directly from Virtual Hard Disk image
The advantage is evident: you can have different Windows 7 deployments on your machine without resort to virtualization software, thus using the full potential of your hardware.
Being a developer, a recurring challenge is to have a development environment setup that doesn't permanently compromise the workstation's performance. The compromise is consequence of sometimes having database and application servers, as well as different IDE all installed and running services at the same time.
Usual solution to avoid such compromise are:
- having virtual machines, dedicated to each development scope, and using them individually without installing any development software on the host. However, virtualization can have a big cost on hardware performance.
- Remote desktop to a hosted development environment instance. This limits the environment's accessibility (usually to the workplace) and is not an option for small companies.
Given this options, the VHD boot architecture seems very attractive. the downside to this option is that its only available on the Ultimate and Enterprise versions of Windows.
To find a walk-through of common scenarios of native VHD boot, visit this technet's page.
Judging by the way things progress, it's will soon be possible to run Hyper-V on a Windows client OS system.
Windows Server 2008: "You do not have sufficient privileges to complete this installation for all users of the machine."
While trying to run the setup file the following error appeared: "You do not have sufficient privileges to complete this installation for all users of the machine."
The current user logged on was a local administrator so all privileges were adequate. After a short googling, the root cause was identified: User Access Control. It's also present on Windows Server 2008 and enforces notification before any changes are made to the system.
The solution:
- Go to Start > Control Panel
- Select User Accounts
- Select User Accounts (again!)
- Select Change User Account Control settings
- Change the security level to never notify
- Restart the machine
After a successful installation you can always revert the settings to the more secure ones.
Windows 7 God Mode
It's a nice feature to perform super user tasks.
Distributed Transactions on Windows 2008 Systems - I
The main catch to this distributed architecture is that it works based on the hosts NetBIOS names, which is specific to the Windows operating systems and is used for network resource sharing and the like.
There are at least four relevant deployment scenarios concerning this technology:
- Full stack on the same physical host
- DHCP reliant network, all hosts on the same segment
- DHCP reliant networks, with firewalls between segments
- Static Address network with firewalls
The first scenario, full stack, isn't challenging because it assumes you have the Application Server and Databases all in the same machine. It can be imagined as the common scenario for developer machines which often have the IDE, DB Server and App Server all-in-one.
The second scenario where all hosts reside on the same network segment, usually a net mask of 255.255.255.0, requires only additional configuration if there are no WINS server available and network broadcast of packages has been disabled. Otherwise the default configuration will work fine.
Next post will discuss a configuration scenario with a firewall in between the Application Server and the Database Server.
