Jump to content

brian873

Member
  • Posts

    335
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Posts posted by brian873

  1. Thanks everyone I have it working the way I need it now.

    @allen2 - thats a fair point and a good one to look out for. However in this environment there are no nested groups and all usernames are generated from another system so should be fine with the current task.

    @Yzöwl - I have used the line you provided, thanks very much :)

    FOR /F "USEBACKQ TOKENS=2 DELIMS==," %%# IN ("%groupname%Extract.txt") DO ECHO=%%#>>"%groupname%Trim.txt"

    I will take a look at the other methods tools mentioned, but I can get what I need for now!

    Cheers

  2. Hi Jaclaz, thanks for the reply

    Sorry !%newName! was a typo, it should be !newName!

    Ok here is the information you asked for.

    When the CMD file prompts for input at the line

    set /p groupname=enter groupname:

    I am entering Accounts

    Working CMD file


    @echo off
    CLS

    echo.
    set /p groupname=enter groupname:
    echo.
    echo.
    dsquery * domainroot -filter "(&(objectClass=group)(name=""%groupname%""))" -l -d DomainName -attr member >>GroupMemberExtract.txt

    CLS
    setlocal enabledelayedexpansion
    FOR /F "tokens=1 delims=," %%a IN ( GroupMemberExtract.txt ) DO (
    set oldName=%%a
    set newName=!oldName:~3!
    echo !newName!>>GroupMemberTrim.txt
    )
    SETLOCAL DISABLEEXTENSIONS

    :END

    GroupMemberExtract.txt

    CN=Joe Bloggs,OU=Accounts,OU=User Accounts,DC=DomainName,DC=company,DC=co,DC=uk

    GroupMemberTrim.txt

    Joe Bloggs

    Non working CMD file with vairables

    @echo off
    CLS

    echo.
    set /p groupname=enter groupname:
    echo.
    echo.
    dsquery * domainroot -filter "(&(objectClass=group)(name=""%groupname%""))" -l -d DomainName -attr member >>"%groupname%Extract.txt"

    CLS
    setlocal enabledelayedexpansion
    FOR /F "tokens=1 delims=," %%a IN ( "%groupname%Extract.txt" ) DO (
    set oldName=%%a
    set newName=!oldName:~3!
    echo !newName!>>"%groupname%Trim.txt"
    )
    SETLOCAL DISABLEEXTENSIONS

    :END

    AccountsExtract.txt

    CN=Joe Bloggs,OU=Accounts,OU=User Accounts,DC=DomainName,DC=company,DC=co,DC=uk

    AccountsTrim.txt

    AccountsExtract.txt

    So as you see, using the variables in this example throws out the %%a in the for loop and instead of phrasing the contents it uses the filename.

  3. Hi,

    I have a CMD file which extracts users from an Active Directory group then trims it so only the username is displayed in the output file GroupMemberTrim.txt.

    It works fine, however I would like to use dynamic file names instead of static

    GroupMemberExtract.txt -> %groupname%-Extract.txt

    GroupMemberTrim.txt -> %groupname%-Trim.txt

    When I change this it breaks the FOR loop so the %%a variable does not read in the contents of %groupname%-Extract.txt instead it reads the filename %groupname%-Extract.txt as the %%a variable.

    Does anyone have any ideas how this could be fixed?

    Thanks :)


    @echo off
    CLS

    :GroupsMembersExtract
    echo.
    set /p groupname=enter groupname:
    echo.
    echo.
    dsquery * domainroot -filter "(&(objectClass=group)(name=""%groupname%""))" -l -d DomainName -attr member >>GroupMemberExtract.txt


    :GroupsMembersTrim
    CLS
    setlocal enabledelayedexpansion
    FOR /F "tokens=1 delims=," %%a IN ( GroupMemberExtract.txt ) DO (
    set oldName=%%a
    set newName=!oldName:~3!
    echo !%newName!>>GroupMemberTrim.txt
    )
    SETLOCAL DISABLEEXTENSIONS


    :END

  4. Hi, I am looking for some help with a VB script I am trying to improve.

    The script runs at logon and pulls out some AD information to create an email signature for the user in Outlook 2003. The script is working fine but I would now like to add in a check so if a field is blank, it does not include that section the in signature.

    The issue is that not all users have fax numbers so I would like to check the fax and only include the line


    objSelection.TypeText "Direct Fax: " & strFax

    if it is not empty.

    Any pointers ?

    Full Script


    On Error Resume Next

    Set objSysInfo = CreateObject("ADSystemInfo")

    strUser = objSysInfo.UserName
    Set objUser = GetObject("LDAP://" & strUser)

    strName = objUser.FullName
    strTitle = objUser.Title
    strDepartment = objUser.Department
    strCompany = objUser.Company
    strPhone = objUser.telephoneNumber
    strFax = objUser.facsimileTelephoneNumber

    Set objWord = CreateObject("Word.Application")

    Set objDoc = objWord.Documents.Add()
    Set objSelection = objWord.Selection

    Set objEmailOptions = objWord.EmailOptions
    Set objSignatureObject = objEmailOptions.EmailSignature

    Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

    objSelection.Font.Name = "Arial"
    objSelection.Font.Size = "10"
    objSelection.Font.Bold = True
    objSelection.TypeParagraph()
    objSelection.TypeText strName
    objSelection.TypeParagraph()
    objSelection.TypeText strTitle
    objSelection.TypeParagraph()
    objSelection.TypeText "Direct Dial: " & strPhone
    objSelection.TypeParagraph()
    objSelection.TypeText "Direct Fax: " & strFax

    Set objSelection = objDoc.Range()

    objSignatureEntries.Add "AD Signature", objSelection
    objSignatureObject.NewMessageSignature = "AD Signature"
    objSignatureObject.ReplyMessageSignature = "AD Signature"

    objDoc.Saved = True
    objWord.Quit

  5. Hi, I would like know the following....

    If I have a video file that is 2.4mb and 20 seconds long how much data is transferred each second of the video?

    Can anyone help?

    I have tried the following but it doesn't look correct to me.

    2.4mb = 2,400kb (2,400/20 = 120kb)

    Thanks

    brian

  6. Hi RJM, thanks for the reply. I seem to have come with a different figure form you.

    Can anyone confirm what it right?

    Thanks

    7.5Mb = 7,500Kb = 7,500,000 bytes = (7,500,000 x 8 bits = 60 million bits. Divide that by sixty seconds in a minute and you get a data rate of 1 million bits per second or 1Mbps.

  7. Hi I would like to know the calculation so I can work out data transfer rates on my lan.

    I have found online calculators that do the job but I would like to know how they do it!

    Any advice is welcome.

    Thanks

    brian

    An example would be:

    "It takes 1 minute to download a 7.5 MB data file. At what bit rate is the data being transferred?"

  8. Hi, from what I can gather you cannot slipstream service packs on to the small business edition of office 2003 because it will not let you create an installation point.

    I was wondering if there was another way round this so I could create a secure default install without having to install everything separately.

    Many thanks

    brian

  9. thanks ctrl-x, I know about that setting. But the problem with it for me, is it gives you an extra click. If you use the above script it puts the text on the same screen you enter your logon details in.

    It is a mod that I really like. I would just liekt o be able to deploy it through a GPO.

    Thanks again for your input

  10. Hi

    I am having trouble creating a custom ADM template file that will add some text to the logon prompt in winXP.

    So far I have in my ADM file (mysetting.adm)

    CLASS MACHINE
    CATEGORY !!category
    CATEGORY !!categoryname
    POLICY !!policyname

    KEYNAME "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
    EXPLAIN !!explaintext
    PART !!labeltextlp EDITTEXT
    DEFAULT "By logging on you agree to company policy"
    VALUENAME "LogonPrompt"

    END PART
    END POLICY
    END CATEGORY
    END CATEGORY

    [strings]
    category="merle Custom Policy Settings"
    categoryname="WinLogon Banner"
    policyname="LogonPrompt"
    explaintext="Add Logon text to the win logon."
    labeltextlp="LogonPrompt"

    What I am trying to do here is currently achieved via a vbs logon script as shown below. Although this works I would like to get it in to the AD so things are nice and tidy.

    On Error Resume Next
    Const SUCCESS = 0
    Const LogERROR = 1
    Const WARNING = 2
    Const INFORMATION = 4
    Const AUDIT_SUCCESS = 8
    Const AUDIT_FAILURE = 16

    Dim Path
    Set WSHShell = Wscript.CreateObject("WScript.Shell")
    Path= "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
    WSHShell.RegWrite path & "LogonPrompt","Stop! This system processes electronic mail classified as Private under the Electronics Communications and Privacy act of 1986. Law enforcement officers please take note that special warrants may be required to access this system.","REG_SZ"
    If err then
    msgbox "Error Encountered"
    WshShell.LogEvent LogERROR, "Logon Prompt Setup Failed"
    Else
    msgbox "Logon Prompt Setup Sucessful"
    WshShell.LogEvent INFORMATION, _
    "Logon Prompt Setup Was Successful."
    End if

×
×
  • Create New...