how can i create similar script in powershell

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 6 months ago.

  • Author
    Posts
  • #6380

    by muzz at 2013-02-06 02:31:10

    Set ObjFso = CreateObject("Scripting.FileSystemObject")

    StrFileName = "C:\SCOM\Scripts\WOLFMonitoring\ErrorLog.txt"

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

    set oRS = CreateObject("ADODB.Recordset")

    oRS.Open "EXEC MOC.dbo.spDirectoryMonitors", sConnectString

    Do While Not oRs.EOF

    sRecID = oRS("RecID")

    sDescription = oRS("Description")

    sFolderPathUNC = oRS("FolderPath_UNC")

    sThresholdMins = oRs("ThresholdMins")

    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 ArtB0514 at 2013-02-06 08:55:08

    Go to http://social.technet.microsoft.com/wiki/contents/articles/183.windows-powershell-survival-guide.aspx and search for VBScript.

    by muzz at 2013-02-06 15:19:31

    I didn't get any similar script on that link , could you navigate me

    by ArtB0514 at 2013-02-07 07:18:19

    I doubt that you're going to find a similar script. The VBScript links should give you guidance on converting VBScript to PowerShell. A similar search for "SQL" will help you with coding SQL connections and queries in PowerShell.

You must be logged in to reply to this topic.