Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Modify dsquery user


  • Please log in to reply

#1
brycecoonce

brycecoonce

    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
:start
cls
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

:Yes

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)

Pause
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

Advertisements


#2
brycecoonce

brycecoonce

    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)...

http://i1329.photobu...zps23c09ddb.png

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