DBThomson76
asked on
Powershell script to replace IFMEMBER
I am cuurently using a logon cmd script to check and do something and write to a file the first time.
Can someone help me to convert this from a command script to a Powershell script?
example:
:ADOBEREADER
REM This Accepts the use aggreement
IFMEMBER "AdobeReader"
IF %ERRORLEVEL%==0 GOTO NEXTSTEP
ECHO IN AdobeReader!
IF EXIST "%homeshare%\2K12AdobeRead er.LOG" GOTO NEXTSTEP
REGEDIT /I /S C:\Scripts\Regfiles\AdobeR eader.Reg
ECHO Adobe Reader settings imported on %TODAY% at %NOW% >"%homeshare%\XEN2K12Adobe Reader.LOG "
:NEXTSTEP
Thanks!
Can someone help me to convert this from a command script to a Powershell script?
example:
:ADOBEREADER
REM This Accepts the use aggreement
IFMEMBER "AdobeReader"
IF %ERRORLEVEL%==0 GOTO NEXTSTEP
ECHO IN AdobeReader!
IF EXIST "%homeshare%\2K12AdobeRead
REGEDIT /I /S C:\Scripts\Regfiles\AdobeR
ECHO Adobe Reader settings imported on %TODAY% at %NOW% >"%homeshare%\XEN2K12Adobe
:NEXTSTEP
Thanks!
ASKER
Michal,
Your script almost worked. It did not convert the %homeshare% which caused it to fail.
I needed to add $HomeShare = $env:HOMESHARE to the script for it to convert properly and then I changed the %homeshare% to be $HomeShare and then it worked.
Thanks!
Your script almost worked. It did not convert the %homeshare% which caused it to fail.
I needed to add $HomeShare = $env:HOMESHARE to the script for it to convert properly and then I changed the %homeshare% to be $HomeShare and then it worked.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Looks good
accepted solution
Open in new window