none
Creating / converting powershell script out of .cmd file RRS feed

  • Question

  • Hi all, 

    I need some assistance translating/converting  .cmd script to powershell, below the content of the cmd. thanks !

    @ECHO OFF
    CLS
    :: [000] Init
    :: -----------------------------------------------------------------------------
    SETLOCAL ENABLEDELAYEDEXPANSION
    SET MYPATH=%~DP0
    SET MYPATH=%MYPATH:~0,-1%

    SET INSTSOURCE=C:\INSTALL

    SET REMINSTSOURCE=\\PATH\Tools

    SET LOCALSCRIPTS=C:\SCRIPTS

    SET SCRIPTTEMP=C:\TEMP

    SET TOOLSDIR=C:\TOOLS

    SET C_DRIVEDIR=\\PATH\LOCALDISKS\C

    SET D_DRIVEDIR=\\PATH\LOCALDISKS\D

    :: -----------------------------------------------------------------------------
    :: Delete Log files C:\Temp
    :: -----------------------------------------------------------------------------

    DEL "%SCRIPTTEMP%\*.log"
    DEL "%SCRIPTTEMP%\*.txt"


    ECHO ----------------------------------------------------------------------------- > "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO BEGIN SCRIPT >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"


    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [001] Disable Logons to prevent logons during startup >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    net stop BrokerAgent >> "%SCRIPTTEMP%\PROGRESS.TXT"
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\VirtualDesktopAgent" /v ListOfDDCs /t REG_SZ /d "cxdc03.company.net cxdc04.company.net" /f >> "%SCRIPTTEMP%\PROGRESS.TXT"
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\VirtualDesktopAgent" /v ListOfDDCs /t REG_SZ /d "cxdc03.company.net cxdc04.company.net" /f >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CHANGE LOGON /DISABLE 

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Sync local disks
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [002] Sync local disk C: >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    NET USE X: \\PATH\LOCALDISKS\C
    SET DESTDIR1=C:\
    SET SOURCEDIR=X:\
    SET EXEC=Robocopy.exe
    ::
    :: Sync C: Drive
    %EXEC% %SOURCEDIR% %DESTDIR1% /E /ZB /R:2 /W:5
    ::Remove X: Drive
    NET USE X: /DELETE /YES

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    :: -----------------------------------------------------------------------------
    :: WMI Reset
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [003] WMI Reset >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    REM C:
    REM cd \
    REM cd Windows\System32\
    REM lodctr /R >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM cd \
    REM cd windows\syswow64
    REM lodctr /R >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM winmgmt /resyncperf >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM wmiadap /f >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM net start pla >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM net stop iphlpsvc >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM net stop Winmgmt && net start Winmgmt >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM net start iphlpsvc >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Install printer drivers
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [008] Install printer drivers >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    FOR %%A IN (BC) DO IF %%A==%computername:~0,2% GOTO PRINTFailover
    GOTO PRINTPRODUCTION
    :PRINTFailover
    CSCRIPT /NoLogo "%LOCALSCRIPTS%\PRINTERS\addprintersBC-FP01.vbs" >> "%SCRIPTTEMP%\PROGRESS.TXT"
    GOTO SkipPRINTFailover
    :PRINTPRODUCTION
    CSCRIPT /NoLogo "%LOCALSCRIPTS%\PRINTERS\addprintersCUF02.vbs" >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CSCRIPT /NoLogo "%LOCALSCRIPTS%\PRINTERS\addprintersPS02.vbs" >> "%SCRIPTTEMP%\PROGRESS.TXT"
    :SkipPRINTFailover

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: SAP change language
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [015] SAP change language >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    del "C:\Program Files (x86)\SAP\SAP Business One\GUI\*.*" /F /S /Q >> "%SCRIPTTEMP%\PROGRESS.TXT"
    copy "C:\Apps\SAP\GUI\*.*" "C:\Program Files (x86)\SAP\SAP Business One\GUI" /Y >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CACLS "C:\Program Files (x86)\SAP\SAP Business One\AddOns" /T /E /G Users:F >> "%SCRIPTTEMP%\PROGRESS.TXT"
    del "C:\Program Files\SAP\SAP Business One\GUI\*.*" /F /S /Q >> "%SCRIPTTEMP%\PROGRESS.TXT"
    copy "C:\Apps\SAP9\GUI\*.*" "C:\Program Files\SAP\SAP Business One\GUI" /Y >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CACLS "C:\Program Files\SAP\SAP Business One\AddOns" /T /E /G Users:F >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Import Hosting Corp root certificate 
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [017] Import Hosting Corp root and Inshared certificate  >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    %TOOLSDIR%\certmgr.exe -add "\\server\shared\mycert.cer" -s -r localMachine root -c >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CERTUTIL -addstore -enterprise -f -v root c:\INSTALL\Certificates\mycert\ComodoSecureRoot.cer >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CERTUTIL -addstore -enterprise -f -v root c:\INSTALL\Certificates\mycert\comodorsadomainvalidationsecureserverca.crt >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Register Imageviewer OCX 
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [019] Register Imageviewer OCX   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    regsvr32.exe "C:\Windows\SysWOW64\ImageViewer2.OCX" /s >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Security change for DTW 
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [022] Security change for DTW   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    CACLS "C:\Program Files (x86)\SAP\Data Transfer Workbench" /T /E /G Users:C >> "%SCRIPTTEMP%\PROGRESS.TXT"
    CACLS "C:\Program Files (x86)\SAP\SAP Business One\Crystal" /T /E /G Users:C >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: bookmark.ntf copy
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [029] bookmark.ntf copy  >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    copy "C:\Install\Notes\bookmark.ntf" "C:\Notes\common\IBM\Notes\Data\Shared" /Y >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Remove printers
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [031] Remove send to OneNote printer   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    printui.exe /dl /n "Send To OneNote 2010" /q


    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Disable Windows Search for Outlook 2016 
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [033] Disable Windows Search for Outlook 2016   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "PreventIndexingOutlook" /t REG_DWORD /d "1" /f >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: CTXHook fix
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [037] CTXHook fix   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\CtxHook" /v "ExcludedImageNames" /t REG_SZ /d 
    "Mtb.exe,winword.exe,excel.exe,appvstreamingux.exe" /f >> "%SCRIPTTEMP%\PROGRESS.TXT"
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\CtxHook" /v "ExcludedImageNames" /t REG_SZ /d 
    "Mtb.exe,winword.exe,excel.exe,appvstreamingux.exe" /f >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"


    :: --------------------------------------------------------------------------------
    :: Install Receiver for PNAgent SSO 
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [039] Install Receiver for PNAgent SSO    >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    "\\PATH\LOCALDISKS\c\Install\Receiver 47\CitrixReceiver.exe" /silent SelfServiceMode=False /ALLOWADDSTORE=A /includeSSON /STORE0="PNAgent;http://cxsf.comany.net/Citrix/Silo/PNAgent/config.xml;on;PNAgent COMPANY"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    :: -----------------------------------------------------------------------------
    :: Remove SCCM Agent
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [041] Remove SCCM Agent   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    %WINDIR%\ccmsetup\ccmsetup.exe /uninstall >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Add CopyTransHEICforWindows
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [042] Add CopyTransHEICforWindows   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    \\PATH\LOCALDISKS\c\Install\CopyTransHEICforWindows\CopyTransHEICforWindowsv1.004.exe /VERYSILENT >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: Start Citrix Broker service
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [043] Start Citrix Broker service   >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    net start BrokerAgent >> "%SCRIPTTEMP%\PROGRESS.TXT"

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    :: -----------------------------------------------------------------------------
    :: Load App-V 5.2
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [666] Load App-V 5.2 packages >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    App-v script 

    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"


    :: -----------------------------------------------------------------------------
    :: Enable Logons users
    :: -----------------------------------------------------------------------------

    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO [999] Enable Logons users >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ----------------------------------------------------------------------------- >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    hostname >> "%SCRIPTTEMP%\PROGRESS.TXT"
    net stop w32time && net start w32time >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM net start BrokerAgent >> "%SCRIPTTEMP%\PROGRESS.TXT"
    change logon /enable >> "%SCRIPTTEMP%\PROGRESS.TXT"
    w32tm /query /status >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM cscript.exe c:\windows\system32\slmgr.vbs /ato >> "%SCRIPTTEMP%\PROGRESS.TXT"
    REM cscript "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" /sethst:dc03.company.net >> "%SCRIPTTEMP%\PROGRESS.TXT"
    cscript "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" /act >> "%SCRIPTTEMP%\PROGRESS.TXT"
     
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO ------------------------------------ END ------------------------------------ >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"
    ECHO. >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :: -----------------------------------------------------------------------------
    :: End of script
    :: -----------------------------------------------------------------------------

    ECHO ============================END OF SCRIPT===================================== >> "%SCRIPTTEMP%\PROGRESS.TXT"

    :END


    • Edited by EF75 Tuesday, December 3, 2019 11:17 PM
    Tuesday, December 3, 2019 10:45 PM

All replies

  • Is this a joke. You don't really expect anyone to do this for you. If this is important then you will need to contact a consultant to do this for you.

    See the following:

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


    \_(ツ)_/

    Tuesday, December 3, 2019 10:56 PM
  • hi, I'm not asking to create the whole script, but just give me a headlines how to start, especially the variabls and the Sync parts.. 

    Thanks! 

    Tuesday, December 3, 2019 11:20 PM
  • The only place to start is to learn PowerShell. When you have learned PowerShell then start converting and ask specific questions as they arise.


    \_(ツ)_/

    Tuesday, December 3, 2019 11:40 PM
  • There is another question you need to consider. Why would you need to convert this to PowerShell? If it works just use it.


    \_(ツ)_/


    • Edited by jrv Tuesday, December 3, 2019 11:43 PM
    Tuesday, December 3, 2019 11:43 PM
  • we want to move to PS , thats why..do you want me to delete this question from the forum?

    Tuesday, December 3, 2019 11:46 PM
  • we want to move to PS , thats why..do you want me to delete this question from the forum?

    No. Just learn PowerShell first then try to do the conversion. The batch is a good thing to keep in mind while you learn as it will help inform you as to the way to use PowerShell and will help you see how PowerShell is more efficient than batch. Refer back to the batch as you learn to see what you can change.

    Here is a starter to get you going but is only useful if you are taking PS training in some formal way.

    "ECHO" is "Write-Output" in PowerShell.
    "Set myvar=something" is "$myvar='something'" in PowerShell.

    Here is a starter book that is both free and one of the best available for beginners.

    https://www.sapien.com/books_training/Windows-PowerShell-4

    You cannot learn PowerShell by guessing or copying others.  You cannot learn PowerShell by reading blogs.  All of these things are only useful after you have learned basic PowerShell.  They will help you refine and expand the basics but will be misleading if you don't know the basics.


    \_(ツ)_/

    Wednesday, December 4, 2019 12:28 AM