Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Modify dsquery user

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 2 posts
Hi, I have a script that I was writing and needed some help with it.

Here is the current script:
@Echo Off
Echo Created by Your Truly

set /p Name=Enter Domain Username here:

Echo %Name%

Echo Employee ID
dsquery user -samid "%name%" | dsget user -empid | find /V "empid" | find /V "dsget"
if errorlevel 1 cls
if errorlevel 1 Echo USERNAME NOT FOUND - Please try again
if errorlevel 1 pause
if errorlevel 1 goto start

net user %name% /domain | find /i "Full Name"
net user %name% /domain | find /i "Comment"
net user %name% /domain | find /i "Account Active"
net user %name% /domain | find /i "password last set"
net user %name% /domain | find /i "password expires"
net user %name% /domain | find /i "password changeable"
net user %name% /domain | find /i "password required"
net user %name% /domain | find /i "User may change password"
net user %name% /domain | find /i "Last Logon"
type "\\server\share\%name%.txt" | find /i "computername"
type "\\server\share\%name%.txt" | find /i "Address"

FOR /F "TOKENS=2* DELIMS=:" %%A IN ('FIND /i "Computername" "\\server\share\%name%.txt"') DO FOR %%B IN (%%A) DO SET COMPNAME=%%B

SET /P YNvar=Connect using Dameware? Y or N?
Echo %YNVar%
if "%YNVar%"=="Y" goto Yes
if "%YNVar%"=="y" goto Yes
if "%YNVar%"=="Yes" goto Yes
if "%YNVar%"=="yes" goto Yes

Goto Start


IF EXIST "%ProgramFiles(x86)%" (start /d "%ProgramFiles(x86)%\DameWare Development\DameWare Mini Remote Control 7.5" dwrcc.exe -c: -h: -m:%COMPNAME% -u:myUsername -p:myPassword -d:clovisusd) ELSE (start /d "%ProgramFiles%\DameWare Development\DameWare Mini Remote Control 7.5" dwrcc.exe -c: -h: -m:%COMPNAME% -u:myUsername -p:myPassword -d:clovisusd)

Goto Start


This script works fine, but what I want it to do is reference the out put of::: "net user %name% /domain | find /i "password expires" ::: and (at the bottom) Echo "Expired" or "Not Expired" based on the current date.

Any help with this would be amazing.
Thank you again.

Also, if you have a better solution with .vbs let me know.

Edited by brycecoonce, 24 June 2013 - 08:32 AM.

  • 0




    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
This is the output when I run the script...

Posted Image

This is what I want it to look like (kinda)...


Edited by brycecoonce, 24 June 2013 - 08:39 AM.

  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP