none
need help converting VB script to PowerShell RRS feed

  • Question

  • was given this VB Script so not to much documents on it but need to convert it to PowerShell 

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists("CreateReports.dll") Then   
    'wscript.Echo "Installing Create Reports Active X..."
    ' Copy a File
    Const OverwriteExisting = TRUE
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "CreateReports.dll" , "c:\windows\CreateReports.dll", OverwriteExisting
    objFSO.CopyFile "CreateReports3704.txt" , "c:\windows\CreateReports3704.txt", OverwriteExisting 
    commandreg="CreateReports.dll"
    Set WshShell = CreateObject("WScript.Shell") 
    WshShell.Run "regsvr32 /s "& commandreg 
    Set WshShell = CreateObject("WScript.Shell") 
    End If
    Wscript.Quit
    

    Tuesday, February 12, 2019 2:08 PM

All replies

  • Looks like they are just copying two files and then registering a DLL

    Look into Copy-Item and regsvr32 should work as is

    Copy-Item -Path "CreateReports.dll","CreateReports3704.txt" -Destination "C:\Windows" -Force
    
    regsvr32 /s C:\Windows\CreateReports.dll


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''


    • Edited by clayman2 Tuesday, February 12, 2019 3:19 PM script
    • Proposed as answer by Javid Doe Tuesday, February 12, 2019 6:09 PM
    Tuesday, February 12, 2019 3:16 PM
  • This forum is not for free script writing. It is for questions about a script you are writing.

    Please carefully review the following links to set your expectation for posting in  technical forums.

    This Forum is for Scripting   Questions Rather than script requests 

    Script Gallery.

    Forum for Script requests
     
     


    \_(ツ)_/

    Tuesday, February 12, 2019 6:21 PM
    Moderator
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, February 28, 2019 2:33 PM
    Moderator