can some one tell me how to create similar (below)script in

by muzz at 2013-02-06 15:26:37

et ObjFso = CreateObject(“Scripting.FileSystemObject”)

StrFileName = "C:\ErrorLog.txt"



sConnectString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=GVLDEVSQL1;Initial Catalog=MOC"



set oRS = CreateObject(“ADODB.Recordset”)

oRS.Open “EXEC MOC.dbo.spSCOM_GetLes”, sConnectString



Do While Not oRs.EOF



sRecID = oRS(“RecID”)

sDescription = oRS(“Description”)

sFolderPathUNC = oRS(“FolderPath_UNC”)

sThresholdMins = oRs(“ThresholdMins”)



DIM file, Date2, Date1, timeDiff, testDate

dim fso: set fso = CreateObject(“Scripting.FileSystemObject”)

dim folder:set folder = fso.getFolder(sFolderPathUNC)



If folder.files.Count > 1 Then

’wscript.echo (“more than one”)
by DonJ at 2013-02-06 16:10:55
As a note, you can use the CODE button to format your script. That’s much appreciated as it makes it easier to read.

Did you look at the references I gave you at viewtopic.php?f=2&t=1193?

Please understand that nobody is going to rewrite your script for you. We’re happy to point you to resources where you can learn how. But your script isn’t a simple rewrite because it uses ADO, which is a very old technology. The new technology is actually a bit shorter in code, but you will need to read how to do it for yourself.
by muzz at 2013-02-07 00:40:43
Thanks jones , I just wanted to know to connect the sql using powershell
by DonJ at 2013-02-07 07:22:38
And all of the resources I mentioned will show you how. You can also look at http://www.mssqltips.com/sqlservertip/1 … ntication/.