Jump to content

Recommended Posts

Posted

Hey all

 

Over the weekend i had a thought, Would it be possible to create a program that will ask for a computer name for it to start delprof2 off.

 

I have a bat file that i change the the name of the computer and start the Remote Registry Service and query and then start the delprof2 off ?(deleting +30 day old profiles) (showing me what user profile its deleting before it happens)

 

Any ideas on where to start?

Posted

If you already have a working BAT file can you just use that and ask for an input at stage one for computer name?

 

Or did you want a "program" as such.

 

Steve

Posted
If you already have a working BAT file can you just use that and ask for an input at stage one for computer name?

 

Or did you want a "program" as such.

 

Steve

 

Would be nice for it to ask for computer name at stage one. In the bat file i retype the computers name about 3 times

Posted
Not something I've touched in a long time but I think a simple Visual Basic window can be made to take the user input and then pass the result as a variable to the command line for delprof to pick up in the same way...
Posted
Not something I've touched in a long time but I think a simple Visual Basic window can be made to take the user input and then pass the result as a variable to the command line for delprof to pick up in the same way...

 

I installed VB on friday and my mind just went blank, I havent messed with VB since college days. (that was 5 1/2 years ago)

Posted

 @echo off

call :ComputerName "Enter ze computer fool!:" "PC Name"
echo You choose %CompName%
REM DoYourDelProfCommandHere

exit /b

:ComputerName
set CompName=
set heading=%~2
set message=%~1
echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\CompNameTemp.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\CompNameTemp.vbs" "%message%" "%heading%"') do set CompName=%%a
exit /b

 

Steve

Posted

PowerShell can popup a VB inputbox very easily.

 

Add-Type -AssemblyName Microsoft.VisualBasic
$ComputerName = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a computer name:", "Window Title", "")

Posted

Not sure if this would work but ripping bits out of a long VBscript I have and tweaking:

 

strComputer = InputBox("Enter Computer name")
Set objShell = CreateObject("WScript.Shell")
strString = "delprof2 /c:"
intshort = 100
objShell.Run "cmd"
Wscript.Sleep intshort
objShell.SendKeys strString & strComputer
objShell.SendKeys "{ENTER}"

 

Save it as a .vbs file

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...