brian873

Member
  • Content count

    335
  • Joined

  • Last visited

Community Reputation

0 Neutral

About brian873

Contact Methods

  • Website URL
    http://www.celticfc.net
  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 I will take a look at the other methods tools mentioned, but I can get what I need for now! Cheers
  2. Thanks jaclaz & Yzöwl OK that makes sense now. I cant test it at the moment, will do it tomorrow. My only concern would be that %groupname% in some cases will contain spaces. I think omitting the " " will cause a problem. I will report what I find.
  3. 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 GroupMemberTrim.txt 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 AccountsTrim.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.
  4. 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
  5. Hi Guys, thanks for both your help ! Thats it working fine for me now
  6. 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
  7. Thanks Ponch ! I have got it now.... and thanks again Mijzelf I think I have just learned somethign new today
  8. Thanks Mijzelf great utility ! Although I would still like to know how to calculate this, anyone help my brain is thinking too hard about it and I cant find the solution.... Any help appreciated
  9. Hi I am trying to work out how long it will take to transfer a file over different networks. If I have a 50mb file how long would it take to transfer using gprs @ 80kbps and edge @ 236kbps any help would be appreciated
  10. Excel 2007 will not let me enter two ** Maybe we can continue this on monday ! Thanks for helping out.
  11. Sorry skylark53 you are loosing me here. What I would use is... 5.42 x 10 x 10 x 1- = 5420 (10 to the power of 3) Why do you use use ** twice ?
  12. Thanks again for the reply skylark53 but I think we are talking about two different things here. It is not the format I am concerned about it is how to perform the calculation.
  13. Hi skylark53, thanks for the reply. Sorry I copy and pasted he last post and the format was lost. So... 5.42 × 103 = 5,420 should have been 5.42 x 10 (to the power of) 3 = 5,420 Any ideas?
  14. Hi I would like to know how to use scientific notation in excel. Can anyone help? I'll use the following as an example. 5.42 × 103 = 5,420 Thanks brian
  15. OK got it no.... 2.4 * 1024 / 20 = 123