The postings on this site are my own and do not represent my Employer's positions, advice or strategies.

LifeAsBob - Blog

 

Home

No Ads ever, except search!
Friday, April 19, 2024 Login
Public

Blog posts for the month of December,2015.
Send me an Email when SPID is done.12/26/2015 11:39:18 AM

Have you ever started a process and then realized, it's taking a long time, you don't want to sit there and watch it, and wish you had put a line in at the end of the batch to send you an email when it was done...

Or had a long running job that you had to wait on, that didn't send an email as it's last step.

Happens to me from time to time, this script will monitor a SPID and send you an email when it's done and every 10 minutes to let you know it's still running.


-- email someone when a spid is completed (idle) or no longer exists
declare @spid int = 60
declare @email_to varchar(50) = 'rhorkay@hrblock.com'
declare @completed_subj varchar(50) = 'SPID ' + convert(varchar(10),@spid) + ' is completed.'

declare @check_in_time_in_minutes int = 10 
declare @check_in_subj varchar(50) = 'SPID is still running'

Declare @message varchar(100) = 'Your Message from server: ' + @@Servername

declare @status varchar(100) = Null
Declare @loop_continue int = 1

while @loop_continue >= 1
Begin

 select top 1 @status = [status] from sysprocesses
  where spid = @spid

 if @status in ('suspended', 'runnable')
 begin
  waitfor delay '00:01'
  if @loop_continue = 10
  begin

   exec msdb..sp_send_dbmail
    @profile_name = 'SQL Mail',
    @recipients = @email_to,
    @Subject = @check_in_subj,
    @body = @message

   set @loop_continue = 1
  end
  else
  begin
   set @loop_continue += 1
  end

 end
 else
 begin  
  exec msdb..sp_send_dbmail
   @profile_name = 'SQL Mail',
   @recipients = @email_to,
   @Subject = @completed_subj,
   @body = @message

  set @loop_continue = 0
  break
 end
END

Telnet Client Missing12/26/2015 9:58:46 AM

DISM /online /enable-feature /featurename:TelnetClient

It's always frustrating when new server images don't have the TelnetClient installed.

 I usually use Package Manager to install, http://www.lifeasbob.com/2015/08/01/InstallingTelnetClientOnWindows.aspx , but lately that has not always worked. 

I found a new way here: 

http://blogs.technet.com/b/joscon/archive/2010/08/26/adding-features-with-dism.aspx 

DISM /online /enable-feature /featurename:<name of feature>

Note: The featurename syntax is case sensitive so make sure you're typing it out as it appears in the list below.

http://blogs.technet.com/b/joscon/archive/2010/08/26/adding-features-with-dism.aspx

The following is the feature list for Windows 2008 R2 SP1:

Features listing for package : Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~6.1.7601.17514


----------------------------------------------------------- | --------
Feature Name                                                | State  
----------------------------------------------------------- | --------
DirectoryServices-DomainController-Tools                    | Disabled
IIS-WebServerRole                                           | Enabled
IIS-WebServer                                               | Enabled
IIS-CommonHttpFeatures                                      | Enabled
IIS-HttpErrors                                              | Disabled
IIS-HttpRedirect                                            | Disabled
IIS-ApplicationDevelopment                                  | Enabled
IIS-Security                                                | Enabled
IIS-URLAuthorization                                        | Disabled
IIS-RequestFiltering                                        | Enabled
IIS-NetFxExtensibility                                      | Enabled
IIS-HealthAndDiagnostics                                    | Enabled
IIS-HttpLogging                                             | Disabled
IIS-LoggingLibraries                                        | Disabled
IIS-RequestMonitor                                          | Disabled
IIS-HttpTracing                                             | Disabled
IIS-IPSecurity                                              | Disabled
IIS-Performance                                             | Enabled
IIS-HttpCompressionDynamic                                  | Disabled
IIS-WebServerManagementTools                                | Enabled
IIS-ManagementScriptingTools                                | Disabled
IIS-IIS6ManagementCompatibility                             | Disabled
IIS-Metabase                                                | Disabled
WAS-WindowsActivationService                                | Enabled
WAS-ProcessModel                                            | Enabled
WAS-NetFxEnvironment                                        | Enabled
WAS-ConfigurationAPI                                        | Enabled
IIS-HostableWebCore                                         | Disabled
IIS-ISAPIExtensions                                         | Disabled
IIS-ISAPIFilter                                             | Disabled
IIS-StaticContent                                           | Disabled
IIS-DefaultDocument                                         | Disabled
IIS-DirectoryBrowsing                                       | Disabled
IIS-WebDAV                                                  | Disabled
IIS-ASPNET                                                  | Disabled
IIS-ASP                                                     | Disabled
IIS-CGI                                                     | Disabled
IIS-ServerSideIncludes                                      | Disabled
IIS-CustomLogging                                           | Disabled
IIS-BasicAuthentication                                     | Disabled
IIS-HttpCompressionStatic                                   | Disabled
IIS-ManagementConsole                                       | Disabled
IIS-ManagementService                                       | Disabled
IIS-WMICompatibility                                        | Disabled
IIS-LegacyScripts                                           | Disabled
IIS-LegacySnapIn                                            | Disabled
IIS-FTPServer                                               | Disabled
IIS-FTPSvc                                                  | Disabled
IIS-FTPExtensibility                                        | Disabled
Smtpsvc-Admin-Update-Name                                   | Disabled
Smtpsvc-Service-Update-Name                                 | Disabled
NetFx3                                                      | Enabled
WCF-HTTP-Activation                                         | Enabled
WCF-NonHTTP-Activation                                      | Enabled
DirectoryServices-DomainController                          | Disabled
DirectoryServices-ADAM                                      | Disabled
OEMHelpCustomization                                        | Disabled
CorporationHelpCustomization                                | Disabled
Printing-LPRPortMonitor                                     | Disabled
Printing-InternetPrinting-Client                            | Disabled
Printing-AdminTools-Collection                              | Disabled
BitLocker                                                   | Disabled
BitLocker-RemoteAdminTool                                   | Disabled
BdeAducExtTool                                              | Disabled
SimpleTCP                                                   | Disabled
SNMP                                                        | Disabled
WMISnmpProvider                                             | Disabled
Microsoft-Windows-Web-Services-for-Management-IIS-Extension | Disabled
LightweightServer                                           | Disabled
MicrosoftWindowsPowerShellISE                               | Disabled
RemoteAssistance                                            | Disabled
WSRM                                                        | Disabled
TelnetServer                                                | Disabled
TelnetClient                                                | Disabled
BiometricFramework                                          | Disabled
IIS-WindowsAuthentication                                   | Disabled
IIS-DigestAuthentication                                    | Disabled
IIS-ClientCertificateMappingAuthentication                  | Disabled
IIS-IISCertificateMappingAuthentication                     | Disabled
IIS-ODBCLogging                                             | Disabled
Printing-Server-Role                                        | Disabled
Printing-LPDPrintService                                    | Disabled
BusScan-ScanServer                                          | Disabled
Printing-InternetPrinting-Server                            | Disabled
FaxServiceConfigRole                                        | Disabled
FaxServiceRole                                              | Disabled
DFSR-Infrastructure-ServerEdition                           | Disabled
DHCPServer                                                  | Disabled
DHCPServer-Tools                                            | Disabled
DHCPServer-RSATClient-Tools                                 | Disabled
NetworkLoadBalancingFullServer                              | Disabled
FailoverCluster-FullServer                                  | Disabled
NetworkLoadBalancingManagementClient                        | Disabled
FailoverCluster-AdminPak                                    | Disabled
InkSupport                                                  | Enabled
DesktopExperience                                           | Enabled
MediaPlayback                                               | Enabled
WindowsMediaPlayer                                          | Enabled
HandwritingRecognition                                      | Disabled
AppServer                                                   | Disabled
AppServer-UI                                                | Disabled
Licensing                                                   | Disabled
Licensing-UI                                                | Disabled
SessionDirectory                                            | Disabled
SBMgr-UI                                                    | Disabled
WebAccess                                                   | Disabled
SUA                                                         | Disabled
Microsoft-Windows-Deployment-Services                       | Disabled
Microsoft-Windows-Deployment-Services-Transport-Server      | Disabled
Microsoft-Windows-Deployment-Services-Deployment-Server     | Disabled
Microsoft-Windows-Deployment-Services-Legacy-SIS            | Disabled
Microsoft-Windows-Deployment-Services-Admin-Pack            | Disabled
ActiveDirectory-PowerShell                                  | Disabled
DirectoryServices-AdministrativeCenter                      | Disabled
DNS-Server-Full-Role                                        | Disabled
DirectoryServices-ADAM-Tools                                | Disabled
DNS-Server-Tools                                            | Disabled
WINSRuntime                                                 | Disabled
Microsoft-Windows-Internet-Naming-Service-AdminTools        | Disabled
IAS NT Service                                              | Disabled
HCSRuntime                                                  | Disabled
HCSUI                                                       | Disabled
RPC-HTTP_Proxy                                              | Disabled
Gateway                                                     | Disabled
Gateway-UI                                                  | Disabled
NPSManagementTools                                          | Disabled
HCAP-Server                                                 | Disabled
RasServer                                                   | Disabled
RasServerAdminTools                                         | Disabled
RasServerAll                                                | Disabled
RasRoutingProtocols                                         | Disabled
RasCMAK                                                     | Disabled
AdminUI                                                     | Disabled
NIS                                                         | Disabled
RSAT-NIS                                                    | Disabled
PSync                                                       | Disabled
WirelessNetworking                                          | Disabled
WindowsRecoveryDisc                                         | Disabled
WindowsServerBackup                                         | Disabled
WindowsServerBackupCommandlet                               | Disabled
ServicesForNFS-ServerAndClient                              | Disabled
ServerForNFS-Infrastructure                                 | Disabled
ClientForNFS-Infrastructure                                 | Disabled
NFS-Administration                                          | Disabled
DFS-Replication-All                                         | Disabled
DfsMgmt                                                     | Disabled
FSRM-Infrastructure                                         | Disabled
FSRM-Management                                             | Disabled
CoreFileServer                                              | Disabled
BITSExtensions-Upload                                       | Disabled
BITSExtensions-AdminPack                                    | Disabled
MSRDC-Infrastructure                                        | Disabled
FRS-Infrastructure                                          | Disabled
StorageManagerForSANs                                       | Disabled
Indexing-Service-Package                                    | Disabled
iSNS_Service                                                | Disabled
Microsoft-Windows-GroupPolicy-ServerAdminTools-Update       | Disabled
TFTP                                                        | Disabled
MultipathIo                                                 | Disabled
DirectoryServices-ISM-Smtp                                  | Disabled
SearchEngine-Server-Package                                 | Enabled
CertificateServicesManagementTools                          | Disabled
CertificateServices                                         | Disabled
OnlineRevocationServicesManagementTools                     | Disabled
OnlineRevocationServices                                    | Disabled
WebEnrollmentServices                                       | Disabled
NetworkDeviceEnrollmentServices                             | Disabled
CertificateEnrollmentPolicyServer                           | Disabled
CertificateEnrollmentServer                                 | Disabled
P2P-PnrpOnly                                                | Disabled
MSMQ-Server                                                 | Disabled
MSMQ-Triggers                                               | Disabled
MSMQ-ADIntegration                                          | Disabled
MSMQ-HTTP                                                   | Disabled
MSMQ-Multicast                                              | Disabled
MSMQ-DCOMProxy                                              | Disabled
MSMQ-RoutingServer                                          | Disabled
Printing-XPSServices-Features                               | Enabled
DFSN-Server                                                 | Disabled
ADFS-FederationService                                      | Disabled
ADFS-FederationServiceProxy                                 | Disabled
ADFS-WebAgentClaims                                         | Disabled
ADFS-WebAgentToken                                          | Disabled
RightsManagementServices                                    | Disabled
RMS-Federation                                              | Disabled
RightsManagementServices-AdminTools                         | Disabled
QWAVE                                                       | Disabled
PeerDist                                                    | Disabled
SIS-Limited                                                 | Disabled
Microsoft-Hyper-V                                           | Enabled
VmHostAgent                                                 | Disabled
Microsoft-Hyper-V-Management-Clients                        | Enabled
DamgmtTools                                                 | Disabled
Internet-Explorer-Optional-amd64                            | Enabled
SMBHashGeneration                                           | Disabled
ServerMigration                                             | Disabled
Xps-Foundation-Xps-Viewer                                   | Disabled
TIFFIFilter                                                 | Disabled
Microsoft-Windows-RemoteFX-Host-Package                     | Disabled
Microsoft-Windows-RemoteFX-EmbeddedVideoCap-Setup-Package   | Disabled

Honey, There are cows out back !12/10/2015 6:48:36 AM

Honey, There are cows out back, and they aren't ours !

Had a couple visitors show up from the neighbors.

 

Outlook parse emails and put into Excel11/18/2015 6:34:51 AM

Macro to parse emails and get information into excel, thanks Ben.

Here’s the rule/macro I’m using to capture the SN Catalog Tasks to Excel. The code for the macro is below and that needs to be added to Outlook first. There are some security settings that need to be changed before Outlook will run the code, so that may be of concern (an alternative would be a VBScript file that would access the mailbox for you allowing you to keep code out of Outlook). Tools -> Macro -> Visual Basic Editor (or Alt+F11) will get you to the VBA code editor.

 

After the code is in place, a normal rule in Outlook can run the modules with the “run a script” action. Here’s how I have my rule set:

The spreadsheet I use is attached. It will probably give you a macro warning because it also has a function (UserSSO()) to lookup a login in Active Directory. It’s set to multi-user mode so Outlook can continue writing to it if it’s open, but the new records seem to show up until it’s been closed and reopened.

 

There are a couple references to be setup (in the code editor: Tools -> References…)  before this code will run

Microsoft ActiveX Data Objects… is needed to write to Excel with an SQL statement.

Active DS Type Library is needed to look up the agent’s login in Active Directory based on the name provided in the ticket.

And, the code (update LogPath to be the location of your spreadsheet):

Public Sub LogRequest(MailMessage As Outlook.MailItem)

'Public Sub LogRequest() '(MailMessage As Outlook.MailItem)

    Dim LogPath As String

    Dim ConnectionString As String

    Dim InsertCommand As String

    Dim olConnection As ADODB.Connection

    LogPath = "C:\Users\a698060\Documents\Current Projects\CatalogTasks.xlsb"

    ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""" & LogPath & """;Extended Properties=""Excel 12.0 Xml;HDR=YES"";"

    Set olConnection = New ADODB.Connection

    'olConnection.Execute "select * from [Sheet1$]"

   

    If InStr(1, MailMessage.Subject, "has been assigned to you") > 5 Then Exit Sub

    Dim MessageBody As String

   

    Dim ReceivedDT As String

    Dim TaskID As String

    Dim RequestID As String

    Dim AssociateName As String

    Dim AccessType As String

    Dim UserType As String

    Dim DBName As String

    Dim ServerName As String

    Dim SecurityAccess As String

    Dim SelectInd As String

    Dim UpdateInd As String

    Dim InsertInd As String

    Dim DeleteInd As String

    Dim Notes As String

    Dim AssociateSSO As String

    Dim Hyperlink As String

    Dim HyperlinkTmp As String

   

    

    MessageBody = MailMessage.Body

    'MsgBox MessageBody

    'Notes = "Catalog Task TASK110993 has been assigned to group SQL DBA"

    'ReceivedDT = "2015-07-22"

    'MsgBox Mid(MessageBody, InStr(1, MessageBody, "Click here to view"), 1000)

   

    'Dim testEntry As String

    'testEntry = "Parent Number: RITM171796" & vbCrLf & _

    '    "Parent Item: SQL" & vbCrLf & _

    '    "Task Description: Provision SQL Database Access" & vbCrLf & _

    '    "Requested For: Puthiyedath, Sudheesh " & vbCrLf & _

    '    "Assignment group: SQL DBA" & vbCrLf & _

    '    "Request options selected:" & vbCrLf & _

    '    "     Who do you wish to request an access change for? = Puthiyedath, Sudheesh " & vbCrLf & _

    '    "     Cannot find user = false" & vbCrLf & _

    '    "     Enter new user's name = " & vbCrLf & _

    '    "     Who is this user's manager? = " & vbCrLf & _

    '    "     Approver = Coquyt, Jeff " & vbCrLf & _

    '    "     User location = Onshore: Inside the United States or territory/possession of United States" & vbCrLf & _

    '    "     Access type = Add" & vbCrLf & _

    '    "     User Type = Service Account" & vbCrLf & _

    '    "     Database Name = eFileODSReporting" & vbCrLf & _

    '    "     Database Location (server name) = tstodssql01.hrbinc.hrblock.net:1433" & vbCrLf & _

    '    "     Security Access Needed = Windows Authentication (Active Directory)" & vbCrLf & _

    '    "     Select (Read) = true" & vbCrLf & _

    '    "     Update = false" & vbCrLf & _

    '    "     Insert = false" & vbCrLf & _

    '    "     Delete = false" & vbCrLf & _

    '    "     null = " & vbCrLf & _

    '    "     Additional information (include items like specific tables needed or other special requests) = Please give access to Database for the account ecoInstall" & vbCrLf

 

   

'''-----------------------Find the keys from the mail message

    ReceivedDT = MailMessage.ReceivedTime

    TaskID = Mid(MailMessage.Subject, 14, 10)

    RequestID = FindKey(MessageBody, "Parent Number", ":")

    AssociateName = FindKey(MessageBody, "Who do you wish to request", "=")

    AccessType = FindKey(MessageBody, "Access type", "=")

    UserType = FindKey(MessageBody, "User Type", "=")

    DBName = FindKey(MessageBody, "Database Name", "=")

    ServerName = FindKey(MessageBody, "Database Location", "=")

    SecurityAccess = FindKey(MessageBody, "Security Access Needed", "=")

    SelectInd = FindKey(MessageBody, "Select", "=")

    UpdateInd = FindKey(MessageBody, "Update", "=")

    InsertInd = FindKey(MessageBody, "Insert", "=")

    DeleteInd = FindKey(MessageBody, "Delete", "=")

    Notes = FindKey(MessageBody, "Additional information", "=")

   

    '''-----------------------Special code to find the hyperlink

    HyperlinkTmp = FindKey(MessageBody, "Click here to view", ":")

    'Hyperlink = ""

    Dim CurChar As Integer

    Dim InLink As Integer

    Dim CurCharStr As String

    Hyperlink = ""

    InLink = 0

   

    'MsgBox HyperlinkTmp

    For CurChar = 1 To Len(HyperlinkTmp)

        CurCharStr = Mid(HyperlinkTmp, CurChar, 1)

        If Mid(HyperlinkTmp, CurChar, 1) = """" Then

            If InLink = 0 Then

                InLink = 1

            ElseIf InLink = 1 Then

                Exit For

            End If

        ElseIf InLink = 1 Then

            Hyperlink = Hyperlink & Mid(HyperlinkTmp, CurChar, 1)

        End If

    Next CurChar

 

'''-----------------------Pad single quotes for inserting into the spreadsheet

    ReceivedDT = Replace(ReceivedDT, "'", "''")

    TaskID = Replace(TaskID, "'", "''")

    RequestID = Replace(RequestID, "'", "''")

    AssociateName = Replace(AssociateName, "'", "''")

    AccessType = Replace(AccessType, "'", "''")

    UserType = Replace(UserType, "'", "''")

    DBName = Replace(DBName, "'", "''")

    ServerName = Replace(ServerName, "'", "''")

    SecurityAccess = Replace(SecurityAccess, "'", "''")

    SelectInd = Replace(SelectInd, "'", "''")

    UpdateInd = Replace(UpdateInd, "'", "''")

    InsertInd = Replace(InsertInd, "'", "''")

    DeleteInd = Replace(DeleteInd, "'", "''")

    Notes = Replace(Notes, "'", "''")

   

    

    AssociateSSO = UserSSO(AssociateName)

   

    

    InsertCommand = "insert into [Sheet1$] (Received, Task, Parent, Server, DB, AssociateName, AssociateSSO, AccessType, UserType, SecurityAccess, [Select], [Update], [Insert], [Delete], Notes, [Hyperlink])" & vbCrLf & _

    "values('" & ReceivedDT & "', '" & TaskID & "', '" & RequestID & "', '" & ServerName & "', '" & _

        DBName & "', '" & AssociateName & "', '" & AssociateSSO & "', '" & AccessType & "', '" & UserType & "', '" & _

        SecurityAccess & "', '" & SelectInd & "', '" & UpdateInd & "', '" & InsertInd & "', '" & _

        DeleteInd & "', '" & Notes & "', '" & Hyperlink & "')"

   

    'InsertCommand = "insert into [Sheet1$] (Received, Task, Parent, Server, DB, AssociateName)" & vbCrLf & _

'"values('2015-05-01', 'TASK110993', 'RITM171796', 'tstodssql01.hrbinc.hrblock.net:1433', 'eFileODSReporting', 'Puthiyedath, Sudheesh')"

 

   

    'MsgBox InsertCommand

   

    olConnection.Open ConnectionString

    olConnection.Execute InsertCommand

    olConnection.Close

End Sub

 

Function FindKey(FindIn As String, FindThis As String, AssignmentInd As String) As String

    Dim KeyStart As Integer

    Dim KeyEnd As Integer

    FindIn = Replace(FindIn, vbCrLf, "<<")

    KeyStart = InStr(1, FindIn, FindThis) + Len(FindThis)

    KeyStart = InStr(KeyStart, FindIn, AssignmentInd) + Len(AssignmentInd) + 1

    KeyEnd = InStr(KeyStart, FindIn, "<<")

   

    FindKey = Trim(Mid(FindIn, KeyStart, KeyEnd - KeyStart))

End Function

 

Public Function UserSSO(LoginName As String) As String

    'SOURCE: Interwebs. Same code seen several places, but adapted

    'to fit this need.

   

    'PURPOSE: Display information that is available in

    'the Active Directory about a given user

    

    'PARAMETER: LoginName = Users name according to Active Directory

   

    'RETURNS: SSO associated with the LoginName provided

   

    'REQUIRES: Windows 2000 ADSI, LDAP Provider

    'Proper Security Credentials.

   

    'EXAMPLE: msgbox UserInfo("Reese, Benjamin")

   

    Dim conn As New ADODB.Connection

    Dim rs As ADODB.Recordset

    Dim oRoot As IADs

    Dim oDomain As IADs

    Dim sBase As String

    Dim sFilter As String

    Dim sDomain As String

   

    Dim sAttribs As String

    Dim sDepth As String

    Dim sQuery As String

    Dim sAns As String

   

    Dim user As IADsUser

   

    On Error GoTo ErrHandler:

   

    'Get user Using LDAP/ADO.  There is an easier way

    'to bind to a user object using the WinNT provider,

    'but this way is a better for educational purposes

    Set oRoot = GetObject("LDAP://rootDSE")

    'work in the default domain

    sDomain = oRoot.Get("defaultNamingContext")

    Set oDomain = GetObject("LDAP://" & sDomain)

    sBase = "<" & oDomain.ADsPath & ">"

    'Only get user name requested

    sFilter = "(&(objectCategory=person)(objectClass=user)(Name=" _

      & LoginName & "))"

    sAttribs = "adsPath"

    sDepth = "subTree"

   

    sQuery = sBase & ";" & sFilter & ";" & sAttribs & ";" & sDepth

                      

    conn.Open _

      "Data Source=Active Directory Provider;Provider=ADsDSOObject"

     

    Set rs = conn.Execute(sQuery)

   

    If Not rs.EOF Then

        Set user = GetObject(rs("adsPath"))

        With user

        'if the attribute is not stored in AD,

        'an error will occur.  Therefore, this

        'will return data only from populated attributes

        On Error Resume Next

       

        sAns = .sAMAccountName

          

        End With

    End If

    UserSSO = sAns

ErrHandler:

   

    On Error Resume Next

    If Not rs Is Nothing Then

        If rs.State <> 0 Then rs.Close

        Set rs = Nothing

    End If

   

    If Not conn Is Nothing Then

        If conn.State <> 0 Then conn.Close

        Set conn = Nothing

    End If

   

    Set oRoot = Nothing

    Set oDomain = Nothing

End Function

Use robocopy for ACL / NTFS File Permissions12/7/2015 9:17:39 AM

Continuously I'm having issues with windows Explorer / File Manager with ACL's and NTFS permissions for SQL Server files, folder and logs.  All this is related to removing permissions and keeping things as granular as possible, but it creates headaches for DBA.

Anyway, always use robocopy for file copy, ensure to open "command prompt" with "run as administrator".  [xopy can work as well, but different switches].

robocopy o:\backups3\ o:\backups\ *.* /MT:10 /e /mir /sec /R:3 /W:15 /XD "RECYCLE" "System Volume Information"

https://www.autoitscript.com/forum/topic/95337-autoit-script-using-robocopy/

http://answers.microsoft.com/en-us/windows/forum/windows_other-windows_programs/how-to-use-robocopy-to-exclude-directories/b4f95d5b-1c5c-e011-8dfc-68b599b31bf5?auth=1

Don't forget that if you detach database in SSMS that sometimes "permissions" to the MDF, NDF and LDF are "removed" and / or replaced with your domain\{id} user credentials, and you may have to "default" them back to "NT Service\MSSQLSERVER" or "NT Service\MSSQL${Instance}" and/or the service account SQL Runs under as well.

 


Blog Home