Anybody here can give me some VB Script advice?

Open discussion about any topic, as long as you abide by the rules of course!
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Anybody here can give me some VB Script advice?

Post by Duhard »

here's the deal...

I need to write all Administrators group users in a .txt file named "admin.txt" using LDAP...then I need to save it on the root drive (C:/).

Now this must be a joke to some of you but since I'm a noob I need some help.

Thanks
R00k
Posts: 15188
Joined: Mon Dec 18, 2000 8:00 am

Post by R00k »

May be useful, with sample code and such:
http://www.ericphelps.com/scripting/

And the MSDN Full language reference:
http://msdn.microsoft.com/library/defau ... erence.asp
denzii
Posts: 426
Joined: Tue Feb 08, 2005 5:02 am

Post by denzii »

Code: Select all

Private fso As New FileSystemObject
Private strm As TextStream    






Set strm = fso.CreateTextFile("\admin.txt", True)
With strm
.WriteLine Text1.Text
.Close
End With
Tormentius
Posts: 4108
Joined: Sat Dec 14, 2002 8:00 am

Post by Tormentius »

Here is what you're looking for Duhard.
denzii
Posts: 426
Joined: Tue Feb 08, 2005 5:02 am

Post by denzii »

Oh boy, was I way off.

I thought you just wanted to save a text file..... sorry about that.
Freakaloin
Posts: 10620
Joined: Tue May 07, 2002 7:00 am

Re: Anybody here can give me some VB Script advice?

Post by Freakaloin »

Duhard wrote:here's the deal...

I need to write all Administrators group users in a .txt file named "admin.txt" using LDAP...then I need to save it on the root drive (C:/).

Now this must be a joke to some of you but since I'm a noob I need some help.

Thanks
is this a joke?
User avatar
GONNAFISTYA
Posts: 13369
Joined: Sun Jan 23, 2005 8:20 pm

Post by GONNAFISTYA »

Fuckin hell Duhy went and turned all nerd on us.

Ban the fucker.
hate.
Posts: 171
Joined: Thu Mar 31, 2005 9:33 pm

Post by hate. »

better nerd

than fatt
stocktroll
Posts: 1314
Joined: Mon Mar 21, 2005 2:44 am

Post by stocktroll »

Code: Select all

string Duhard = "pathetic noob\n";
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

Tormentius wrote:Here is what you're looking for Duhard.
Thanks man :up:
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Re: Anybody here can give me some VB Script advice?

Post by Duhard »

Freakaloin wrote:
Duhard wrote:here's the deal...

I need to write all Administrators group users in a .txt file named "admin.txt" using LDAP...then I need to save it on the root drive (C:/).

Now this must be a joke to some of you but since I'm a noob I need some help.

Thanks
is this a joke?
...are you gay?
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

GONNAFISTYA wrote:Fuckin hell Duhy went and turned all nerd on us.

Ban the fucker.
I'm no nerd you fucktards....It's called having a job to do...nerds.
Tormentius
Posts: 4108
Joined: Sat Dec 14, 2002 8:00 am

Post by Tormentius »

Duhard wrote:
Tormentius wrote:Here is what you're looking for Duhard.
Thanks man :up:
You're welcome.
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

Image
Freakaloin
Posts: 10620
Joined: Tue May 07, 2002 7:00 am

Post by Freakaloin »

Duhard wrote:
GONNAFISTYA wrote:Fuckin hell Duhy went and turned all nerd on us.

Ban the fucker.
I'm no nerd you fucktards....It's called having a job to do...nerds.

lol...having a job to do...so its not an actual job...lol...moron...u can't even get a job...and i don't want want...CRUSHED...
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

Freakaloin wrote:
Duhard wrote:
GONNAFISTYA wrote:Fuckin hell Duhy went and turned all nerd on us.

Ban the fucker.
I'm no nerd you fucktards....It's called having a job to do...nerds.

lol...having a job to do...so its not an actual job...lol...moron...u can't even get a job...and i don't want want...CRUSHED...
I have a job to do and I can't get a job?

ffs make sense you fucktard...
Freakaloin
Posts: 10620
Joined: Tue May 07, 2002 7:00 am

Post by Freakaloin »

job to do...job...different...u...moron...
a defining attribute of a government is that it has a monopoly on the legitimate exercise of violence...
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Re: Anybody here can give me some VB Script advice?

Post by Foo »

Duhard wrote:here's the deal...

I need to write all Administrators group users in a .txt file named "admin.txt" using LDAP...then I need to save it on the root drive (C:/).

Now this must be a joke to some of you but since I'm a noob I need some help.

Thanks
Ey bud, much simpler to do it with the dsquery command.

like this:

dsquery user OU=Security,DC=YOUR_DOMAIN,DC=YOUR_DOMAIN_SUFFIX > admins.txt

Of course, this assumes all your admins are in the security container as they should be :)
Last edited by Foo on Wed Apr 13, 2005 5:23 pm, edited 1 time in total.
"Maybe you have some bird ideas. Maybe that’s the best you can do."
― Terry A. Davis
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Post by Foo »

BTW that's a command you can launch from any server or terminal server, from the command prompt.

it's not on a regular workstation without some fag admin pack.
"Maybe you have some bird ideas. Maybe that’s the best you can do."
― Terry A. Davis
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

well...anybody here nerdish enough to figure this out?

In the registry, I must create 2 keys (UserName and Group) in the following location...HKCU\Software\NerdishVBS

...I ain't got time for this shit...time to hit the gym and fuck your girlfriends, loosers.

P.S Visual Basic only please...thanks.
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

Tormentius you faggot...where are you?
Freakaloin
Posts: 10620
Joined: Tue May 07, 2002 7:00 am

Post by Freakaloin »

'©2003 Prentice Hall
'By Geoff Leach
'Created/Revised: 04/20/05
'Procedure for calculating a loan payment.
Public Class Form1
Inherits System.Windows.Forms.Form
Friend sngPrincipal As Single
Friend sngRate As Single
Friend intTerm As Integer
#Region "Data Validation"
Private Sub txtPrincipal_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtPrincipal.Validating
Try
If Val(txtPrincipal.Text) < 2000 Or Val(txtPrincipal.Text) > 50000 Then
Throw New Exception
End If
Catch ex As Exception
'Cancel the event and select the text to be corrected by the user
e.Cancel = True
txtPrincipal.Select(0, txtPrincipal.Text.Length)
MsgBox("The loan amount must be a number between 2000 and 50000.", MsgBoxStyle.Critical, "Invalid Entry!")

End Try
End Sub

Private Sub txtRate_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtRate.Validating
Try
If Val(txtRate.Text) < 0.025 Or Val(txtRate.Text) > 0.125 Then
Throw New Exception
End If
Catch ex As Exception
'Cancel the event and select the text to be corrected by the user.
e.Cancel = True
txtRate.Select(0, txtRate.Text.Length)
MsgBox("The loan rate must be a decimal value greater then zero and less than 12.5%.", MsgBoxStyle.Critical, "Invalid Entry!")
End Try
End Sub

Private Sub txtTerm_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtTerm.Validating
Try
If Val(txtTerm.Text) < 1 Or Val(txtTerm.Text) > 10 Then
Throw New Exception
End If
Catch ex As Exception
'Cancel the event and select the text to be corrected by the user.
e.Cancel = True
txtTerm.Select(0, txtTerm.Text.Length)
MsgBox("The loan term must be at least 1 and not more than 10.", MsgBoxStyle.Critical, "Invalid Entry!")

End Try
End Sub
#End Region
#Region "Procedures"
Sub CalculatePayment()
'Assign values to variables
sngPrincipal = Val(txtPrincipal.Text)
sngRate = Val(txtRate.Text) / 12
intTerm = Val(txtTerm.Text) * 12

'Call the LoanPayment function
lblMonthlyPayment.Text = Format(LoanPayment(sngPrincipal, sngRate, intTerm), "Currency")
End Sub

Function LoanPayment(ByVal Principal, ByVal Rate, ByVal Term) As Decimal
'Calculate the monthly payment, and return the value to the calling procedure.
Return Principal * (Rate / (1 - (1 + Rate) ^ -Term))
End Function

Friend Sub AppExit()
Dim intResponse As Integer
intResponse = MsgBox("Do you really want to exit this application?", 276, "Exit?")
If intResponse = 6 Then
End
End If
End Sub
#End Region

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
Friend WithEvents mnuFileCalculate As System.Windows.Forms.MenuItem
Friend WithEvents mnuFileExit As System.Windows.Forms.MenuItem
Friend WithEvents lblPrincipal As System.Windows.Forms.Label
Friend WithEvents lblRate As System.Windows.Forms.Label
Friend WithEvents lblTerm As System.Windows.Forms.Label
Friend WithEvents txtPrincipal As System.Windows.Forms.TextBox
Friend WithEvents txtRate As System.Windows.Forms.TextBox
Friend WithEvents txtTerm As System.Windows.Forms.TextBox
Friend WithEvents lblPayment As System.Windows.Forms.Label
Friend WithEvents lblMonthlyPayment As System.Windows.Forms.Label
Friend WithEvents btnCalculate As System.Windows.Forms.Button
Friend WithEvents lblCopyright As System.Windows.Forms.Label
Friend WithEvents btnExit As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.mnuFile = New System.Windows.Forms.MenuItem
Me.mnuFileCalculate = New System.Windows.Forms.MenuItem
Me.mnuFileExit = New System.Windows.Forms.MenuItem
Me.lblPrincipal = New System.Windows.Forms.Label
Me.lblRate = New System.Windows.Forms.Label
Me.lblTerm = New System.Windows.Forms.Label
Me.txtPrincipal = New System.Windows.Forms.TextBox
Me.txtRate = New System.Windows.Forms.TextBox
Me.txtTerm = New System.Windows.Forms.TextBox
Me.lblPayment = New System.Windows.Forms.Label
Me.lblMonthlyPayment = New System.Windows.Forms.Label
Me.btnCalculate = New System.Windows.Forms.Button
Me.btnExit = New System.Windows.Forms.Button
Me.lblCopyright = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile})
'
'mnuFile
'
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFileCalculate, Me.mnuFileExit})
Me.mnuFile.Text = "&File"
'
'mnuFileCalculate
'
Me.mnuFileCalculate.Index = 0
Me.mnuFileCalculate.Text = "C&alculate"
'
'mnuFileExit
'
Me.mnuFileExit.Index = 1
Me.mnuFileExit.Text = "E&xit"
'
'lblPrincipal
'
Me.lblPrincipal.Location = New System.Drawing.Point(64, 40)
Me.lblPrincipal.Name = "lblPrincipal"
Me.lblPrincipal.Size = New System.Drawing.Size(112, 16)
Me.lblPrincipal.TabIndex = 0
Me.lblPrincipal.Text = "Amount to Borrow:"
Me.lblPrincipal.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblRate
'
Me.lblRate.Location = New System.Drawing.Point(64, 72)
Me.lblRate.Name = "lblRate"
Me.lblRate.Size = New System.Drawing.Size(112, 16)
Me.lblRate.TabIndex = 1
Me.lblRate.Text = "Annual Interest Rate:"
Me.lblRate.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblTerm
'
Me.lblTerm.Location = New System.Drawing.Point(112, 104)
Me.lblTerm.Name = "lblTerm"
Me.lblTerm.Size = New System.Drawing.Size(64, 16)
Me.lblTerm.TabIndex = 2
Me.lblTerm.Text = "Loan Term:"
Me.lblTerm.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'txtPrincipal
'
Me.txtPrincipal.Location = New System.Drawing.Point(200, 40)
Me.txtPrincipal.Name = "txtPrincipal"
Me.txtPrincipal.Size = New System.Drawing.Size(120, 20)
Me.txtPrincipal.TabIndex = 3
Me.txtPrincipal.Text = ""
'
'txtRate
'
Me.txtRate.Location = New System.Drawing.Point(200, 72)
Me.txtRate.Name = "txtRate"
Me.txtRate.Size = New System.Drawing.Size(120, 20)
Me.txtRate.TabIndex = 4
Me.txtRate.Text = ""
'
'txtTerm
'
Me.txtTerm.Location = New System.Drawing.Point(200, 104)
Me.txtTerm.Name = "txtTerm"
Me.txtTerm.Size = New System.Drawing.Size(120, 20)
Me.txtTerm.TabIndex = 5
Me.txtTerm.Text = ""
'
'lblPayment
'
Me.lblPayment.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblPayment.Location = New System.Drawing.Point(72, 136)
Me.lblPayment.Name = "lblPayment"
Me.lblPayment.Size = New System.Drawing.Size(104, 16)
Me.lblPayment.TabIndex = 6
Me.lblPayment.Text = "Monthly Payment:"
Me.lblPayment.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblMonthlyPayment
'
Me.lblMonthlyPayment.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblMonthlyPayment.Location = New System.Drawing.Point(200, 136)
Me.lblMonthlyPayment.Name = "lblMonthlyPayment"
Me.lblMonthlyPayment.Size = New System.Drawing.Size(120, 16)
Me.lblMonthlyPayment.TabIndex = 7
'
'btnCalculate
'
Me.btnCalculate.Location = New System.Drawing.Point(352, 168)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(80, 24)
Me.btnCalculate.TabIndex = 8
Me.btnCalculate.Text = "C&alculate"
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(368, 200)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(64, 24)
Me.btnExit.TabIndex = 9
Me.btnExit.Text = "E&xit"
'
'lblCopyright
'
Me.lblCopyright.Location = New System.Drawing.Point(8, 240)
Me.lblCopyright.Name = "lblCopyright"
Me.lblCopyright.Size = New System.Drawing.Size(384, 16)
Me.lblCopyright.TabIndex = 10
Me.lblCopyright.Text = "©2003 Prentice Hall. Programming with Visual Basic.NET for Business."
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(456, 266)
Me.Controls.Add(Me.lblCopyright)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.lblMonthlyPayment)
Me.Controls.Add(Me.lblPayment)
Me.Controls.Add(Me.txtTerm)
Me.Controls.Add(Me.txtRate)
Me.Controls.Add(Me.txtPrincipal)
Me.Controls.Add(Me.lblTerm)
Me.Controls.Add(Me.lblRate)
Me.Controls.Add(Me.lblPrincipal)
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "Loan Function Application"
Me.ResumeLayout(False)

End Sub

#End Region


Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
CalculatePayment()
End Sub

Private Sub mnuFileCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileCalculate.Click
CalculatePayment()
End Sub

Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
AppExit()
End Sub

Private Sub mnuFileExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
AppExit()
End Sub
End Class
a defining attribute of a government is that it has a monopoly on the legitimate exercise of violence...
Duhard
Posts: 6216
Joined: Sat Dec 11, 1999 8:00 am

Post by Duhard »

what the heck am I looking at?

I seriously hope you're not the moron who built this shit script...wow...ultimate nerd alert
denzii
Posts: 426
Joined: Tue Feb 08, 2005 5:02 am

Post by denzii »

VBS or VB

I have a module here you can alter to do what you want it to do if you wish, but it's in VB6
Post Reply