Jump to content

bbbngowc

Member
  • Posts

    125
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Bahamas

About bbbngowc

Recent Profile Visitors

1,193 profile views

bbbngowc's Achievements

0

Reputation

  1. Hi Everyone, Does anyone have a script (LDAP or VB) that scans the network for machines that have the admin$ disabled?
  2. Hi All, I have 5 Windows 2003 terminal servers in a NLB Cluster. I'm looking for a way to know how many users are currently logged on the entire cluster without having to manually count the number of users on each server. Does anyone have a solution to this? I found this VB script online but I'm not a VB expert so can't get this to work. Please help! foreach ($server in (Get-Content $file)) { $count = (Get-WMIObject Win32_PerfFormattedData_TermService_TerminalServices).TotalSessions "There are {0} users on {1}" -f $count,$Server }
  3. Hi, Thanks IcemanND for the help with the following command. I changed the xcopy to dir for a test before the copy, and it works, but why would it miss the folders with 'spaces' in the name? What's needed to so that it sees all the folders including those with space in the name? for /f %_ in ('dir /ad /b c:\dir\*') do dir "c:\dir\%_\*.*"
  4. Found this online. Thank to the coder for providing it. It works for what I need. @ECHO OFF :: Check Windows version, abort if not NT 4 or later IF NOT "%OS%"=="Windows_NT" GOTO Syntax SETLOCAL ENABLEDELAYEDEXPANSION :: Initialize variables SET PrintCmd= SET Temp=%Temp:"=% SET NumFiles=0 SET MultiPrint=0 SET ListTool= :: Check command line arguments IF "%~1"=="" GOTO Syntax IF NOT "%~3"=="" GOTO Syntax IF "%~2"=="" ( SET FileSpec=%~1 ) ELSE ( IF /I "%~1"=="/M" SET FileSpec=%~2 IF /I "%~2"=="/M" SET FileSpec=%~1 ) ECHO.%* | FIND /I "/M" >NUL && SET MultiPrint=1 ECHO.%FileSpec% | FIND "/" >NUL && GOTO Syntax IF NOT EXIST "%FileSpec%" GOTO Syntax :: Count the number of files specified by filespec FOR %%A IN (%FileSpec%) DO SET /A NumFiles = !NumFiles! + 1 IF %NumFiles% EQU 0 GOTO Syntax :: Check if we need to have access to a list of processes :: currently running, and if so, which one is available IF %NumFiles% GTR 1 SET MultiPrint=1 IF %MultiPrint% EQU 0 CALL :GetListTool :: Get the file association from the registry FOR /F "tokens=1* delims==" %%A IN ('ASSOC .PDF') DO ( FOR /F "tokens=1 delims==" %%C IN ('FTYPE ^| FIND /I "%%~B"') DO ( CALL :GetPrintCommand %%C ) ) :: Check if a print command was found IF NOT DEFINED PrintCmd ( ECHO. ECHO No print command seems to be assiociated with .PDF files on this computer. GOTO Syntax ) :: Print the file using the print command we just found FOR %%A IN (%FileSpec%) DO CALL :ExecPrintCommand "%%~fA" :: A final message IF "%MultiPrint%"=="1" ( ECHO. ECHO You will need to close the Acrobat Reader window manually after the printing ECHO is finished. IF "%NumFiles%"=="1" IF "%ListTool%"=="" ( rem ECHO rem ECHO rem ECHO ) ) :: Done GOTO End :ExecPrintCommand CALL START /MIN "PrintPDF" %PrintCmd% GOTO:EOF :GetListTool :: Now we need to find a tool to check for processes. :: In XP and later this will be the native TASKLIST command, :: in NT 4 and 2000 we'll need to find a non-native tool. :: First we'll try TASKLIST ... TASKLIST >NUL 2>&1 IF ERRORLEVEL 1 ( REM ... if TASKLIST isn't available we'll try TLIST next ... TLIST >NUL 2>&1 IF ERRORLEVEL 1 ( REM ... and if that isn't available either we'll try PSLIST ... PSLIST >NUL 2>&1 IF NOT ERRORLEVEL 1 SET ListTool=PSLIST ) ELSE ( SET ListTool=TLIST ) ) ELSE ( SET ListTool=TASKLIST ) :: Don't worry if we didn't find ANY tool to list processes, in :: that case we'll just assume multiple PDFs need to be printed IF "%ListTool%"=="" SET MultiPrint=1 GOTO:EOF :GetPrintCommand :: Get the print command for this file type from the registry START /WAIT REGEDIT.EXE /E "%Temp%.\pdf.dat" "HKEY_CLASSES_ROOT\%1\shell\print\command" IF NOT EXIST "%Temp%.\pdf.dat" GOTO:EOF FOR /F "tokens=1* delims==" %%D IN ('TYPE "%TEMP%.\pdf.dat" ^| FIND "@="') DO SET PrintCmd=%%E DEL "%Temp%.\pdf.dat" SET PrintCmd=%PrintCmd:\"="% SET PrintCmd=%PrintCmd:""="% SET PrintCmd=%PrintCmd:\\=\% :: The /T switch terminates Acrobat Reader after printing. :: Thanks to Fabio Quieti for sending me this tip. :: However, as Michael Butler pointed out, it should not be :: used when printing lots of files. :: So I introduced a /M switch for this batch file, stating :: that multiple files are to be printed. :: Without specifying the /M switch, this will also be true :: when wildcards are used in the filespec. :: Finally, if another Adobe Reader process is running right :: now, we won't be using the /T switch either. IF %MultiPrint% EQU 0 CALL :CheckProcess %PrintCmd% IF %MultiPrint% EQU 0 ( SET PrintCmd=%PrintCmd:"%1"=/t "%%%~1"% rem SET PrintCmd=%PrintCmd% /t "%%~1" ) ELSE ( SET PrintCmd=%PrintCmd:"%1"="%%%~1"% rem SET PrintCmd=%PrintCmd% "%%~1" ) GOTO:EOF :CheckProcess IF "%ListTool%"=="" ( SET MultiPrint=1 ) ELSE ( %ListTool% 2>&1 | FIND /I "%~n1" >NUL && SET MultiPrint=1 ) GOTO:EOF :Syntax ECHO. ECHO PrintPDF.bat, Version 3.11 for Windows NT 4 / 2000 / XP / Server 2003 ECHO Prints PDF files from the command line ECHO. ECHO Usage: PRINTPDF pdf_filespec [ /M ] ECHO. ECHO Where: "pdf_filespec" is the file name or filespec of the PDF file(s) ECHO to be printed; wildcards allowed (*); use double ECHO quotes for long file names ECHO. rem ECHO Notes: This batch file has been tested with Acrobat Reader versions 5-7 only. rem ECHO It requires Adobe/Acrobat Reader, and will NOT work if Acrobat "Writer" rem ECHO is installed. rem ECHO Thanks to Fabio Quieti, as of version 3.00, you no longer need to close rem ECHO the minimized Acrobat Reader window manually, after printing the file. rem ECHO Thanks to Michael Butler, printing lots of PDFs will no longer make the rem ECHO computer slow down to a crawl or even hang. rem ECHO. rem ECHO Written by Rob van der Woude rem ECHO http://www.robvanderwoude.com :End IF "%OS%"=="Windows_NT" ENDLOCAL
  5. Hi, I'm trying to find all the users in AD that have Dial-in Access. However I need to use the "Control Access through Remote Access Policy" option as a lookup. So something like: where obj=user and AND msNPAccessDialin = TRUE type thing. I have the follow code but it doesn't work for what I'm looking for. Can any help me with a mod please? Const ADS_SCOPE_SUBTREE = 2 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.CommandText = _ "SELECT Name FROM 'LDAP://dc=domain,dc=com' WHERE objectCategory='user' " & _ "AND msNPAccessDialin = TRUE" Set objRecordSet = objCommand.Execute Dim Ts Set Ts = Fso.CreateTextFile("Text_Report.txt") Ts.WriteLine Now objRecordSet.MoveFirst Do Until objRecordSet.EOF Ts.WriteLine objRecordSet.Fields("Name").Value Wscript.Echo objRecordSet.Fields("Name").Value objRecordSet.MoveNext Loop Ts.Close
  6. Hi, Prolly been asked like a zillion times but, is there a way to print pdf files from command line? I tried the AcroRD32.exe /t but the application just opens, prints the doc and stays open. Not until I close the application would it open the other and print. Using Adobe Reader 9.0. Anyone has something to work for this? Thanks.
  7. This is what we had to do to get it resolved as well. thanks for the input people.
  8. Sorry, should've been more specific. Load balancing terminal servers. We have 5 of them.
  9. Hi, Just wondering how to copy directories where the name = ABC* and the files contained therein. I can do a dir /d ABC*, but I can't do a copy or xcopy ABC*\*.* Any suggestions?
  10. Hi, I have 5 Windows 2003 Servers Enterprise. I've setup nlb on them. But it's causing issues with remote sites trying to access. Is possible to set up a single server and have users connect to that and have that server distribute connections to the cluster accordingly? Right now, all the servers in the cluster has a single virtual ip that users hit. All users can hit each server unique IP but not everyone can hit the cluster IP.
  11. Nah. Not between the servers.
  12. I don't know wha else to do short of formating and reinstalling windows which is a big no no. I have a Windows 2003 Server Enterprise Edition that I cannot ping and it cannot ping back. I can ping the local host IP and loop back IP. But I cannot ping the gateway or anything else. I've uninstalled and reinstalled NICs, changed NICS, reset Winsock, reset routing table, reset int ip, changed switch ports. Nothing seems to work. Anyone has any idea or suggestions on what I can try?
  13. Hi, I've setup a few new termainl servers and I would like to put some security in place. What I'm looking for is: when a user logs on ONLY TO THESE SPECIFIC Terminal Servers, they are only presented with a desktop with just 1 or two applications. I don't want them to have access to anything else. No "My Documents", Control Panel, Internet Explorer, or start menu for that matter. This is Windows 2003 Enterprise Server. Oh and I only want this security used when logged in via remote desktop. If I log in at the Console I should not have these limitations. Is this possible? What do I use to accomplish?
  14. I made some small modifications to the script and ran it. It works. Thanks for looking.
×
×
  • Create New...