Solved

WMI Event Watcher

Posted on 2012-03-19
5
207 Views
Last Modified: 2012-06-27
how do i replace the folder name with a variable.
"Win32_Directory.Name=\"c:\\\\Development\\\\temp\""


like.
Win32_Directory.Name=\"@Correct_File""
0
Comment
Question by:aneilg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 290 total points
ID: 37738834
If you mean by SQL code please see below:


declare @string varchar(max),
            @path varchar(255)

set @path = '"c:\\\\Development\\\\temp\"'
SET @string = '"Win32_Directory.Name=\' + @path

print (@string);
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37738856
If you need this at the OS level in CMD or batch file you should use parameters like %1, %2, ...
So in the batch or command file would be something like:



"Win32_Directory.Name="%1

Where %1 = \"c:\\\\Development\\\\temp\""
0
 

Author Comment

by:aneilg
ID: 37741356
sorry for the Confusion, but i am using the WMI Event Watcher Task, and its WMI Options, WqlQuerySource.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37744359
OK, so you have two options in my opinion - if you have the WQL query you can modify it as I mentioned above with the sql example using variables or if you have it in SSIS task you can add task parameter/value:

http://www.simple-talk.com/sql/ssis/passing-variables-to-and-from-an-ssis-task/
http://msdn.microsoft.com/en-us/library/cc280502.aspx
0
 

Author Closing Comment

by:aneilg
ID: 37786872
thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question