get script name
How can I get the name of the script I am running?
FOR EXAMPLE,
Lets say I execute DeployAll.vbs and when this script is running I want to
be able to get the name if script and I store in memory.
If I were to Wscript.Echo Filename,
I would expect DeployAll.vbs.
Thanks! Tag: Script to get my public ip address Tag: 176631
Using VB Script to install software - Need insight -
I was hoping with the wealth of knowledge here that someone could shed some
light on using Vbscript to install software.
Using vbscript to install msi based applications is not a problem, but where
the problem begins is when installing an application or driver package that
does not use the windows installer or uses a setup.exe which does the
preliminary prep work then launches another executable for the installation.
I'm trying to prevent the script from assuming the application is installed
when its not, and kicking off the next application install and fouling up
the process.
Any help would be appreciated!
Thanks in advance,
Jeff Millar Tag: Script to get my public ip address Tag: 176630
Drive Mapping
The problem i have is i have a logon script that map's network drives. The
mapping is done correctly but you display the network drive on a remote
computer the drive shows as being disconnected. You can click on the drive
and it will open up but it stills shows as disconnected. the script is
listed below: Can anyone help and let me know what i'm doing wrong
danny
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath
strDriveLetter = "F:"
strRemotePath = "\\server\Vol1"
' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method. Result F: drive
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit Tag: Script to get my public ip address Tag: 176629
Joing computer script
I have a site with about 160 users. None of the computers are members of the
domain. Most are XP & 2000 clients. I know little about scripting and
looking for some guidance or script that could join computers to the domain.
Make it easy : )
Thanks Tag: Script to get my public ip address Tag: 176628
AD and Login Scripts
Is there a way to get Active Directory to stop running login scripts at the
computer level? I work for a college. I want to give students a particular
profile when they are in our computer lab. And another if they are working in
one of our offices.
I suppose I could build an IF statement into the user script that if
computer ismember of dn=computers then quit. Or is there a better way? Tag: Script to get my public ip address Tag: 176627
Roaming Profiles & Defalut Printer
I am trying to enable an automated method of setting the default printer for
roaming profiles depending on site.
I.E user logs on in Site A they will have PR100 as default when they log on
in Site B they will have PR400. Each site has 50 odd printers so printers
will vary per user...
Any ideas or pointers would be appreciated
Rick Tag: Script to get my public ip address Tag: 176625
How to list all the reg keys under a key
Hi all,
Can anyone tell me if it is possible, and if so how i can read all the
reg keys under a key.
We have a large number of printers and i need to often run a report on
the status and set up of the printers.
Rather than keeping a list of the printers and reading from a text file
i would like to just script it to perform certain tasks on all the
printer keys in
SYSTEM\CurrentControlSet\Control\print\printers\
Thanks in advance Tag: Script to get my public ip address Tag: 176621
outlook.application
Please help, I have a script that will not work. It just stops with
"The specified module could ot be found" Error 8007007E. Is it
somthing to to with the reg file.
Any help received with thanks.
Dim EM
Dim MailItem
MsgBox "Creating Outlook object"
Set EM = CreateObject("Outlook.Application")
MsgBox "Creating e-mail item"
Set MailItem = EM.CreateItem(0)
MsgBox "Setting Email Parmeters"
MailItem.Subject = "A Test"
MailItem.Body = "This text is in the body"
MailItem.Recipients.Add "me@home.com"
MsgBox "Displaying Email Item"
'MailItem.Send
MailItem.Display(True) Tag: Script to get my public ip address Tag: 176618
send parameters with the method action
Hi,
I have a problem, I must send the parameters UserName and Password with the method action from one page that is the form, to the another one,MailBee.asp
<form action="MailBee.asp" method="post" id="form1" name="form1">
Is there anyone who can help me?
-----------------------------
This message is posted by http://asp.forumszone.com Tag: Script to get my public ip address Tag: 176616
Number to binary
Hi all
I am looking for a function similar to:
<% response.write(Hex(460)) %>
converts 469 into its HEX of 1CC
but to do the same with binary
i.e. 5 would give 101
looked through the W3C VBScript lists but nothing
I can do it in javascript:
<script language="javascript" type="text/javascript">
function decimal(dec)
{
this.dec=dec;
this.toBinary=function() { return this.dec.toString(2); }
}
</script>
then document.write(new decimal(5).toBinary());
but need to be able to do it with VBscript to use with my ASP
thanks for any help
Matt Houldsworth
Digitalquill Tag: Script to get my public ip address Tag: 176609
Memory cleanup with VBscript
Okay, this may sound like a dumb questions, but here goes. Does VBscript
clear all variables when the script exists cleanly. Yes I am lasy but I
don't want to set everything to "=Nothing" if I don't have too.
Thanks in advance for your help! Tag: Script to get my public ip address Tag: 176602
Running the script remotely using different credential
I am looking for ways to runs to run VB script locally or remotely
using differential credential other the current logged on user
Like how to run this script on a remote machine by supplying the admin
credential
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
Thanks in advance Tag: Script to get my public ip address Tag: 176589
VBS/MS Word Merge
Hi,
Is it possible to merge data (from SQL Server) via special placeholders
in a Word document ? I noticed that most "Word merge VBs examples" all
create new documents by inserting things like paragrahs in conjunction
to actual data. I'd like to define my template first and then just
replace its placeholders with actual data.
Has anyone ever done this? I'd appreciate if you could give me some
pointers or ... perhaps share some sample code.
Thanks!
JV Tag: Script to get my public ip address Tag: 176588
ComDlg Open read only file and multiple select
The file open dialog box shows a check box "READ ONLY".
(Unless you specify the flag cdlOFNHideReadOnly = 4)
How can the script know if the check box has been checked by the user?
One more question: if multiselect is allowed I can select more than one file. But the
FileName property does not report them all. It only reports the name of the directory. How
can I retrieve all the filenames selected?
Thank you very much.
Giovanni.
Set comDlg=CreateObject("MSComDlg.CommonDialog.1")
const cdlOFNHideReadOnly = 4
const cdlOFNAllowMultiselect = 512
comDlg.Flags = cdlOFNHideReadOnly + cdlOFNAllowMultiselect
comDlg.Filter = "All|*.*| VBScript|*.vbs"
comDlg.maxfilesize=500
comDlg.ShowOpen
msgbox comDlg.FileName
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (VbScript) Tag: Script to get my public ip address Tag: 176584
Retrive office location
Hi,
I need to retrived the office location for all the users in AD. Does anyone
has a vb script for this job?
Thanks,
--
Michelle Tag: Script to get my public ip address Tag: 176574
How do I get stdio in a string vairable from call to Exec?
After i exec a command like below:
Set oExec3 = WshShell3.Exec(command3)
Do While oExec3.Status = 0
WScript.Sleep 1
Loop
WScript.Echo oExec3.Status,",",oExec3.ExitCode
Is there anyway I can get a string copy of stdio in a vaiable generated
by the exec command?
Cheers and thanks,
Jim Tag: Script to get my public ip address Tag: 176573
Read from TXT file
Hi All,
How do extract the following from a text file - lines 5 through to the end
of the file?
Ta
Andi Tag: Script to get my public ip address Tag: 176563
Scripting.FileSystemObject
I'm using a data access page with a bunch of VBscripts, and I want to dump
changes to the access database into a text file. I'm attempting to use the
method shown at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/sgprogrammingfilesystemobject.asp
but I am having no luck. I'm getting the following error:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q311269
I completed their "resolution" but nothing was changed/fixed.
Is there any other solution? Tag: Script to get my public ip address Tag: 176561
Advice for Someone New to Scripting
Hi All,
I am reasonably competant (or maybe reasonable incompetant) at using VBA and
want to create a few small VBS files.
I am getting a bit stuck on the real basics about:-
1) is the Microsoft Script Debugger the best debugging tool for visual basic
script files - if it is, why does it not include .vbs as one of the save
options
2) How would I debug the following code - as when I open it in the microsoft
script debugger all the text is blue and I can't run the code?
Option Explicit
Dim Text, Titel
Dim WshNetwork ' Objektvariable
Text = "Workstation Information" & vbCRLF & vbCRLF
Titel = "GME Online PC Information for HelpDesk"
Set WshNetwork = WScript.CreateObject("WScript.Network")
Text = Text & "Your Computername : " & _
WshNetworK.ComputerName & vbCRLF
Text = Text & "Your Logon Domain : " & _
WshNetworK.UserDomain & vbCRLF
Text = Text & "Your UserID : " & _
WshNetworK.UserName & vbCRLF
MsgBox Text, vbOkonly + vbInformation, Titel
WScript.Quit Tag: Script to get my public ip address Tag: 176557
currently logged on users in a domain!
Hello everybody...
how can I know who's logged on to a domain so that I can do something for
each logon user?
Thanks in advance.
c-mos Tag: Script to get my public ip address Tag: 176556
Windows Common Dialog control problem on Win2k?
Hello,
I have a vbScript that calls the Windows Common Dialog box... On XP, the
script works just fine... But on Win2k workstations, I get "ActiveX
component can't create object".
Set CDObj = CreateObject("MSComDlg.CommonDialog")
if err > 0 then
msgbox err.description
end if
If Err Then
MsgBox "Error: Can't create Dialog Object!?"
WScript.Quit
End If
Any ideas why??
Troy Tag: Script to get my public ip address Tag: 176551
Getting Outlook 2003 folders size
How do I get the current folder size of my mailbox from the Outlook side?
I want to know how much space is my client side (Outlook 2003) is using
without querying my Exchange 2003 server.
Any help is greatly appreciated.
MB Tag: Script to get my public ip address Tag: 176549
Adding a list of URLs to Media Player
Hi,
I have a list of URLs (ASF links) that I want to add to Media Player.
This is what I have so far but it fails when trying to add the URL.
According the WMP SDK, the MediaCollection.Add command should be the
right one. Does anyone know what's wrong?
Dim link
URL = "URL goes here"
'Get list of ASF files from URL
With CreateObject("InternetExplorer.Application")
.Navigate URL
Do Until .ReadyState = 4
Wscript.sleep 10
Loop
for each link in .document.links
Call AddToPlayList
next
.Quit
End With
Sub AddToPlayList
Set objPlayer = CreateObject("WMPlayer.OCX" )
objPlayer.MediaCollection.Add (link)
End Sub Tag: Script to get my public ip address Tag: 176547
How to copy/paste formula in Excel using vbs
Hello,
I'm trying to imitate VBA code in VBS to copy paste formula from a cell to
another but i just cannot get through it.
Any help would b greatly appreciated.
Thanks for your valuable help Tag: Script to get my public ip address Tag: 176545
CreateObject("InternetExplorer.Application") Takes focus!
When I write a script with the line
Set oIE = CreateObject("InternetExplorer.Application")
The newly created Internet Explorer App takes the keyboard and mouse focus
away from the active application.
Since this script runs in the background while the user is working, its is
really annoying to the users and they usually have to stop working until the
script finishes.
Is there any way to do this without stealing the focus? Tag: Script to get my public ip address Tag: 176539
Inputbox value must be written in a specified file
Greetings Vbscript Guru's,
I am a complete Novice so bare with with me.
This is my project I am working on.
I need to place the value entered(for e.g 1.1.1.1) in the inputbox into
a file where it is going to replace a variable called "ipaddress".
When the value is pasted there a new file will be created.
I am having trouble to use the popup box entered value I call it
"input" in my scenario.
See code below.
Thanks in advance for anyone who can help me out here.
AQUILA
-------------begin----------
Const ForReading = 1
Const ForWriting = 2
Dim Input
Set objFSO = CreateObject("Scripting.FileSystemObject")
Input = InputBox("Enter your IP address")
MsgBox ("You entered: " & Input)
Set objFile = objFSO.OpenTextFile("C:\scripts\test.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = Replace(strLine, "ipaddress", & Input)
strNewText = strNewText & strLine & vbCrLF
Loop
objFile.Close
Set objFile = objFSO.CreateTextFile("C:\scripts\test1.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
--------------------------end------------ Tag: Script to get my public ip address Tag: 176533
Compare the values of two sorted arrays of variable size.
Hi,
This seems a bit of an old chestnut but please humour me ;)
My aim is to compare two arrays and identify values in List A which
don't appear in List B. And vice versa. My arrays are one dimensional
and contain names. The number of elements in each array is not fixed.
I've done some searching and there are two basic algorithms. The first
contains a double loop where each element of the inner loop is compared
to elements in the outer loop. At best it kicks out of the inner loop
when a match is found.
The second method seems to be more elegant but assumes the two arrays
have already been sorted. Basically the indeces of the two arrays are
incremented when an unmatched value is found. An example code can be
found below which works ... until you place a unique value as the last
element :(
For example, if I have:
ListA = Array("Andy", "Bob", "Cath", "Dexter")
ListB = Array("Andy", "Bob", "Cath")
BOTH "Cath" and "Dexter" are found to be unique! I switched the values
of list A to B and came up with the same poor result.
I'd appreciate it if someone could give this a fresh look and find the
logic error. I've been staring at it for hours :(
Many thanks in advance,
Andy
Script:
Option Explicit
Dim ListA ' To contain a sorted list of names, unknown size.
Dim ListB ' To contain a sorted list of names, unknown size.
Dim lngAIdx ' Index for list A.
Dim lngBIdx ' Index for list B.
Dim lngMaxAIdx ' Upper value of the A list index.
Dim lngMaxBIdx ' Upper value of the B list index.
Dim intComparison ' Result of comparing two strings
'
ListA = Array("Andy", "Bob", "Cath", "Dexter")
ListB = Array("Bob", "Cath", "Dexter")
lngAIdx = LBound(ListA)
lngBIdx = LBound(ListB)
lngMaxAIdx = UBound(ListA)
lngMaxBIdx = UBound(ListB)
'
Do While (lngAIdx < lngMaxAIdx And lngBIdx < lngMaxBIdx)
'Perform a case insensitive comparison.
intComparison = strComp(ListA(lngAIdx), ListB(lngBIdx), vbTextCompare)
If intComparison = -1 Then ' ListA(lngAIdx) < ListB(lngBIdx)
' Value in A list is not present in the B list.
WScript.Echo "Unique A Value: " & ListA(lngAIdx)
lngAIdx = lngAIdx + 1 ' Update the A list index.
ElseIf intComparison = 1 Then ' ListA(lngAIdx) > ListB(lngBIdx)
' Value in B list is not present in the A list.
WScript.Echo "Unique B Value: " & ListB(lngBIdx)
lngBIdx = lngBIdx + 1 ' Update the B list index.
Else ' intComparison = 0
' The value appears in both lists
lngAIdx = lngAIdx + 1
lngBIdx = lngBIdx + 1
End If
Loop
'
'Having reached this point, one of the lists has finished.
'Display the remaining unique values.
If lngAIdx < lngMaxAIdx Then
For lngAIdx = lngAIdx to lngMaxAIdx
WScript.Echo "Remaining Unique A value: " & ListA(lngAIdx)
Next
End If
'
If lngBIdx < lngMaxBIdx Then
For lngBIdx = lngBIdx To lngMaxBIdx
WScript.Echo "Remaining Unique B value: " & ListB(lngBIdx)
Next
End If
WScript.Quit Tag: Script to get my public ip address Tag: 176520
Debugger won't start
My hard drive crashed and I had to reinstall everything fresh onto a new
hard drive. I'm using Windows XP Pro SP2 with Office 2003, Visual Studio 6
(installed first), and Visual Studio .NET 2003.
For some reason, now the debugger won't start. Normally, I am asked to
select a debugger to use, but now nothing happens.
In Intenet Explorer, if I select View -> Script Debugger -> Open, nothing
happens.
The "Browsing" seciton of the Internet Explorer Advanced options has
"Disable Script Debugging (Internet Explorer)" unchecked and "Disable Script
Debugging (Other)" unchecked, and "Display a notification about every script
error" is checked.
I've searched Google but the only search terms I can think of are too
generic and I get garbage back.
Any ideas on this??
Thanks,
Jon Davis Tag: Script to get my public ip address Tag: 176519
Retrieving DC list
I have a vbscript that needs to get a list of all the DCs in a given domain,
be it NT4 or AD, but I don't know how.
Any ideas?
Thanks,
rb Tag: Script to get my public ip address Tag: 176515
Match MailboxGUID to ADuserAccount
I need to match the MailboxGUID from an Exchange 2003 server to an AD
Account. What WMI/AD property can I seach for that will have this GUID
in it? I tried to use the Legacy information from the mailbox but some
users have name changes (marriage) that fail lookups in AD. Tag: Script to get my public ip address Tag: 176513
WScript Shell SendKeys to HTA
Does anyone know of any limitations to using SendKeys to an HTA?
I'm using a TEXTAREA element and sending keystrokes to it. It seems to work
fine until a certain point. For example, in the code below, upon loading, it
will loop from 1 to 1000, each time adding a line number then going to the
next line.
Results in the textarea _should_ look like this:
1
2
[...snip...]
999
1000
On my PC, it only goes to about 850 and looks like this:
1
2
[...snip...]
849
850
Occassionally it will stop a few characters more or less, but usually right
about that location.
If I run it through less than 850 (i.e. 800, even 845) it runs just fine.
Maybe it's a machine speed limitation? I'd be curious to know if others get
less or more on faster/slower PCs.
I'm on a 3Ghz Dell Precision with 256MB RAM.
--- Code Below ---
<HTML>
<HEAD>
<TITLE>Default HTA</TITLE>
<HTA:APPLICATION>
</HEAD>
<SCRIPT Language="VBScript">
Sub PutInSampleText()
Set WshShell = CreateObject("WScript.Shell")
textbox.focus
st = timer()
For i = 1 to 1000
WshShell.SendKeys i & "{ENTER}"
Next
End Sub
</SCRIPT>
<BODY onLoad=PutInSampleText>
<TEXTAREA COLS=40 ROWS=30 WRAP="off" ID="textbox"></TEXTAREA>
</BODY>
</HTML> Tag: Script to get my public ip address Tag: 176509
script copying folders
I'm looking to copy folders from one drive to another but I want the script
to look inside a .txt file and only move the folders that are named in the
text file. I know how to move one folder at a time with a script but I
don't know how to get the script to look inside a .txt file to do it. Can
anyone help.
Thanks,
KB Tag: Script to get my public ip address Tag: 176507
getting script to run subroutines
The subroutines in this script are supposed to map a group drive and a
network printer but isn't doing either. I'm really DESPARATE to get this
script working. Some have already helped me with it and I appriciate it but
if anyone has the key on how to get this script to map a home drive, all
necessary group drives, and applicable printer I would be greatly
appriciative.
last week my boss gave me a batch file that sort of does this but if a
person is a member of multiple groups it doesn't work.
Thank you,
Mandy Dunn
Option Explicit 'all variables defined prior to use
Dim fServer 'file server
Dim home 'home directory
Dim wshNet '
Dim ADSysInfo
Dim CurrentUser
Dim strGroups
Dim colstrGroups
Dim GroupMember
Dim a,b,c,d
Const CSC = "cn=CSC Windows Service Group"
Const MARKETING = "cn=marketinggroup"
Const SALES = "cn=salesgroup"
fServer = "\\loan.ad.cob.ohio-state.edu"
home = "\\loan\users"
Set wshNet = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" _
& ADSysInfo.UserName)
colstrGroups = CurrentUser.memberOf
If IsEmpty(colstrGroups) Then
strGroups = ""
If strGroups = "" Then
Wscript.Echo("you are not a member of any groups.")
ElseIf TypeName(colstrGroups) = "String" Then
strGroups = LCase(colstrGroups)
Else strGroups =LCase(Join(colstrGroups))
End If
End If
wshNet.MapNetworkDrive "h:", fServer & "\Users\" _
& wshNet.UserName
WScript.Echo(wshNet.Username & " " & strgroups)
Select Case GroupMember
case a = InStr(strGroups, CSC)
CSCsub
case b = InStr(strGroups, SALES)
SalesSub
case c = InStr(strGroups, MARKETING)
MarketingSub
End Select
Sub CSCsub 'This subRoutine maps a printer
WScript.Echo("made it to CSC")
wshNet.MapNetworkDrive "g:","\\loan\group\CSC\"
wshNet.AddWindowsPrinterConnection _
"\\loan\mh320-csc-hp8000"
wshNet.SetDefaultPrinter "\\loan\mh320-csc-hp8000"
End Sub
Sub SalesSub
WScript.Echo("made it to sales")
wshNet.MapNetworkDrive "s:", "\\loan\Sales"
wshNet.AddWindowsPrinterConnection _
"\\loan\SalesPrinter"
wshNet.SetDefaultPrinter "\\loan\SalesPrinter"
End Sub
Sub MarketingSub
WScript.Echo("made it to marketing")
wshNet.MapNetworkDrive "m:","\\loan\Marketing\"
wshNet.AddWindowsPrinterConnection _
"\\loan\MarketingPrinter"
wshNet.SetDefaultPrinter _
"\\loan\MarketingPrinter"
End Sub Tag: Script to get my public ip address Tag: 176504
access excel objects from web page
Is it possible to access excel objects of xls document loaded in the browser
from the vb script of the WEB page? Tag: Script to get my public ip address Tag: 176497
How to pass parameters to vbscript
Hi,
Does anybody know how to pass the parameter to vbscript file. For example
CScript A.vbs <Paramater>
Where can I find the sample vbs code.
Thanks in advance Tag: Script to get my public ip address Tag: 176495
number conversion help needed
I need assistance reversing the conversion function below. Given a real
number I need the result as an 8 character string (hex).
wscript.echo IEEE_to_VAX_float(1.5)
Function IEEE_to_VAX_float(a)
' Dim fraction' As Double
' Dim exponent' As Double
' Dim sign' As Integer
'
' If a = Chr(0) & Chr(0) & Chr(0) & Chr(0) Then
' fraction = 0: exponent = 0
' Else
' sign = (-1) ^ Int(Asc(Mid(a, 2, 1)) / 128)
' exponent = Int(Asc(Left(a, 1)) / 128) + 2 * (Asc(Mid(a, 2, 1)) Mod
128) - 128
' fraction = 0.5 + 2 ^ (-8) * (Asc(Left(a, 1)) Mod 128) _
' + 2 ^ (-24) * Asc(Mid(a, 3, 1)) _
' + 2 ^ (-16) * Asc(Mid(a, 4, 1))
' End If
IEEE_to_VAX_float = ?????
End Function
Its based on the following function which conversts VAX float to IEEE. The
VAX machines had several formats such as VAX F, G and D. I'm not sure which
format this function supports but its the correct one for me.
wscript.echo VAX_float_to_IEEE(Chr(&Hf7) & Chr(&H40) & Chr(&H9f) &
Chr(&H1a))
Function VAX_float_to_IEEE(a)' As Double 'convert vax floats and doubles to
ieee format
Dim fraction' As Double
Dim exponent' As Double
Dim sign' As Integer
' Select Case Len(a)
' Case 8
' If a = Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) &
Chr(0) & Chr(0) Then
' fraction = 0: exponent = 0
' Else
' sign = (-1) ^ Int(Asc(Mid(a, 2, 1)) / 128)
' exponent = Int(Asc(Left(a, 1)) / 16) + 16 * (Asc(Mid(a, 2, 1))
Mod 128) - 1024
' fraction = 0.5 + 2 ^ (-5) * (Asc(Left(a, 1)) Mod 16) _
' + 2 ^ (-21) * Asc(Mid(a, 3, 1)) _
' + 2 ^ (-13) * Asc(Mid(a, 4, 1)) _
' + 2 ^ (-37) * Asc(Mid(a, 5, 1)) _
' + 2 ^ (-29) * Asc(Mid(a, 6, 1)) _
' + 2 ^ (-53) * Asc(Mid(a, 7, 1)) _
' + 2 ^ (-45) * Asc(Mid(a, 8, 1))
' End If
' Case 4
If a = Chr(0) & Chr(0) & Chr(0) & Chr(0) Then
fraction = 0: exponent = 0
Else
sign = (-1) ^ Int(Asc(Mid(a, 2, 1)) / 128)
exponent = Int(Asc(Left(a, 1)) / 128) + 2 * (Asc(Mid(a, 2, 1))
Mod 128) - 128
fraction = 0.5 + 2 ^ (-8) * (Asc(Left(a, 1)) Mod 128) _
+ 2 ^ (-24) * Asc(Mid(a, 3, 1)) _
+ 2 ^ (-16) * Asc(Mid(a, 4, 1))
End If
' Case Else
' sign = 1
' fraction = "some text to generate error"
' exponent = 0
' End Select
VAX_float_to_IEEE = fraction * sign * 2 ^ exponent
End Function
thanks
LJB Tag: Script to get my public ip address Tag: 176492
ADO connection through UDL file
Using VBS - this works:
conn.open "Provider=SQLOLEDB.1;Password=X;Persist Security
Info=True;User ID=Y;Initial Catalog=MyDB;Data Source=MyServer"
However this does not:
conn.open "File Name=uaccess.udl"
(the UDL file contains the same working connection string)
I've tried every combination of FileName/FILE NAME, but no joy. Tag: Script to get my public ip address Tag: 176491
User account and Personal folder mismatch script
HI
I found this script a few weeks ago and found it perfect til i realised it
had a few limitations. The original script was great and thanks to the guys
for there work.
The problem i'm finding is that my servers don't have the same amount of
folders as users, be default service accounts and other admin accounts etc
don't run the logon script and hence don't have a personal folder.
From what i can understand the script gets to the end of the folder list and
then stops which isn't ideal as there are many more user accounts etc that it
isn't checking.
Here is the code and i would appreciate any help as the theory of what i
need to do is confusing me already. There is a lot of tidying i can do with
the script but in the meantime i really need the script to check the entire
contents of the personal folder location and the entire contents of the
domain user list if possible
Thanks
M
-----------------------------------------
'=================
'Name: orphanV2.vbs
'Author: Tim Sullivan
'Date: 04.01.2005
'Info: This is a script to check for orphaned home folders. It reads the
name of the folder, and
' looks for a corresponding AD user account. The original concept for this
script was done by
' Alan Kaplan (alan@akaplan.com), and a lot has been borrowed from it.
'
' I made this one to look at the folder names, rather than the SID of the
folder owner. This
' worked better for me, as our home folder names are the same as our domain
usernames.
'=================
Dim AppendOut
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wshShell = WScript.CreateObject ("WScript.Shell")
strDomain = WSHNetwork.UserDomain
strComputer = WSHNetwork.ComputerName
'=================
'Pre script running checks.
'===
syscheck
'===
'If Wscript is being used, script is restarted with Cscript instead.
'===
If (Not IsCScript()) Then
WshShell.Run "CScript.exe " & quote & WScript.ScriptFullName & quote, 1,
true
WScript.Quit
End If
'=================
'User input area and error checking.
'=================
strDomain = InputBox("Enter your netbios domain name here.", "Domain Name",
strDomain)
If strDomain = "" Then
quitmessage = "Domain cannot be blank. Exiting!"
Abort
End If
strTargetServer = Inputbox("Enter the target server name.", "Target Server
Name", strComputer)
If strTargetServer = "" Then
quitmessage = "Target server cannot be blank. Exiting!"
Abort
End If
strTargetServer = UCase(strTargetServer)
strStartFolder = InputBox("Enter the starting folder path. Be sure not to
put any leading or trailing slashes. Follow the example in the box.", "Search
Start Path", "C:\Documents and settings")
If strStartFolder = "" Then
quitmessage = "Starting folder cannot be blank. Exiting!"
Abort
End If
'=====
'Convert inputs to UNC
'=====
strUNCStart = "\\" & strTargetServer &"\"& Replace(strStartFolder,":","$")
WScript.Echo strUNCStart
If not objFSO.FolderExists(strUNCStart) Then
quitmessage = strUNCStart & " Not Found"
abort
End If
'====
'Prepare our output log file
'====
logsetup
'=================
'=================
'Here we get our list of folders, and call our function to actually find
'our little lost orphanes.
'====
Set objFolder = objFSO.GetFolder(strUNCStart)
Set colSubfolders = objFolder.Subfolders
For Each objSubFolder in colSubfolders
strCheckFolder = objSubFolder.name
Validate(strCheckFolder)
If strADPres = "Present" Then
EchoAndLog Date & "," & Time & "," & strUNCStart & "\" &
objSubFolder.Name & "," & "Folder/User is ok."
Else
EchoAndLog Date & "," & Time & "," & strUNCStart & "\" &
objSubFolder.Name & "," & "Folder/User is bad. User Not Found!"
End If
Next
'=================
'Functions and sub-routines
'=================
'System check functions. Checks VBScript version, and verifies WMI is
installed.
Sub syscheck()
Dim major,minor, ver, key, key2
major = (ScriptEngineMinorVersion())
Minor = (ScriptEngineMinorVersion())/10
Ver = major + minor
If err.number or ver < 5.5 then
quitmessage = "You have WScript Version " & ver & ". Please load
Version 5.5"
End If
err.clear
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed
Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\version"
key2 = WshShell.RegRead (key)
if err <> 0 then
quitmessage = quitmessage & "ADSI must be installed on local
workstation to continue" & vbCrLf
abort
End if
End Sub
'===
'Function to handle aborting the script.
'===
Function Abort() 'error message handler
wshShell.Popup quitmessage,0,"Abort",vbCritical
WScript.Quit
End Function
'====
'Sub routine for preparing the output log file.
'====
Sub logsetup()
On Error goto 0
Dim arTemp
logpath= wshShell.SpecialFolders("Desktop") & "\"
arTemp= Split(WScript.ScriptName,".") 'Script Name found"
logfile = logpath & artemp(0)& ".csv" 'append .CSV
'setup Log
WriteType = 2 ' forwriting 'presume for writing. Usually
done as constant...
If objFSO.FileExists(logfile) Then
retval = MsgBox("Logfile Exists, do you want to append?",vbyesno +
vbdefaultbutton1,"Old Log File")
If retval = vbyes Then
writeType = 8 'change type to append
End If
End If
On Error Resume next
Set AppendOut = objFSO.OpenTextFile(logfile, WriteType, True)
If Err <> 0 Then
MsgBox "You must close the log file!",vbcritical +
vbinformation,"Fatal Error"
WScript.Quit
End If
On Error goto 0
If WriteType = 2 Then 'only write header if new file
Appendout.writeline "Date,Time,Folder UNC,Status"
End If
End sub
'=====
'Output subroutine
'=====
Sub EchoAndLog (message)
Wscript.Echo message
AppendOut.WriteLine message
End Sub
'===
'Function for determining if CScript is being used.
'===
Function IsCScript()
If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = True
Else
IsCScript = False
End If
End Function
'===
'Function for comparing foldername against AD.
'===
Function Validate(strCheckFldr)
On Error Resume Next
Dim objSAMUser
Err.Clear
Set objSAMUser = GetObject("WinNT://" & strDomain & "/" & strCheckFolder &
",user")
If Err.Number = 0 Then
strADPres = "Present"
Validate = True
Else
strADPres = "NotPresent"
Validate = False
End If
Set objSAMUser = Nothing
End Function
'================
'End Of Script
'================ Tag: Script to get my public ip address Tag: 176487
How to capture cgi variables in VBScript
Hi All,
Can somebody suggest me how to capture the cgi variable in vbscript
do we have some geCGIVariable() function in vbscript
Thanks and Regards
Bala Tag: Script to get my public ip address Tag: 176481
WinNT provider scripts not always returning complete results
Can someone please explain this to me..
I run the following script as it is and i get the complete list of disabled
user accounts in either my Windows 2003 domain or the NT4 domain we have.
However if i comment out the Wscript.Echo and un-commment the txt.Writeline
line below it i only get approx 14 users returned when it should return 177
users. That is against a Win 2003 domain.
It's pretty frustrating and i'm really trying to figure out why. As you will
see the logging to the text file also logs the Full Name and LostLogin but
surely that shouldn't effect the results.
Can anyone please help with this as i have a few others scripts i use that i
really need to know i'm getting the consistent results from.
Thanks in advance
On Error Resume Next
' Create system objects
Set wshShell = Wscript.CreateObject("Wscript.Shell")
Counter = 0
strDomain = InputBox("Enter your domain name here.", "Domain Name")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oFileSys = CreateObject ("Scripting.FileSystemObject")
Set txt = oFileSys.OpenTextFile (strDesktop & "\" & strDomain & "_" &
"_DisabledUsers.csv", 2, True)
txt.WriteLine "User Name" & "," & "Users Full Name" & "," & "Last Login Time"
Set objDomain = GetObject("WinNT://" & strDomain)
objDomain.Filter = Array("User")
WScript.Echo "The following domain accounts are disabled in domain: " &
UCase (objdomain.Name)
For Each UserAccount In objDomain
If UserAccount.AccountDisabled = True Then
WScript.Echo UserAccount.Name
'txt.WriteLine UserAccount.Name & "," & UserAccount.FullName & "," &
UserAccount.LastLogin
End If
Next Tag: Script to get my public ip address Tag: 176479
web based email client and attachments
hello
if somebody send out any documents with web based email, how can i check or
make a copy from this file?
it should be a security setting but i cannot find any. Is there any script
which can log or make a copy it for me? Tag: Script to get my public ip address Tag: 176478
connect printers by IP
Hi,
I would like to know how can I install printers if:
i) I know the IP of all printers and all of them are not connected to print
servers.
ii) The drivers are all at stored at the a network drive
Thanks in advance. Tag: Script to get my public ip address Tag: 176476
WMI Script - Query Syntax
I am trying to query the EventLogs to determine if they are exceeding 80% of
their maximum file size, but this query doesn't retun any records. Here is
my query string:
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NTEventlogFile
where (FILESIZE > (.80 * MAXFILESIZE)) and filename = 'appevent' ", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
If I change the compare operand to "<=", it doesn't return any records
either. SO, I assume that the querystring doesn't like the (.80 *) muliplier
in the query.
As of now, my work around is to return all records and use an If...then to
determine if the FILESIZE is 80% of the MAXFILESIZE.
...just trying to cut corners! My guess is that the type cast for the
FILESIZE and MAXFILESIZE is character - not number?? ...any clues?
PS...I have debugged the "numbers" - the querystring is logically correct
and should return a record set.
--
-Kevin Tag: Script to get my public ip address Tag: 176466
How do I edit security on a batch of user account
Windows 2003 and Exchange 2003:
I need to modify all of the user accounts so the SELF group has "Send As
and Recieve As" rights for exchange assigned to it. I want to add them if
they are not there "not" replace what's there already.
Can I just script this or do I need to use Dsacls.exe or some similar tool
with a script?
Any recommendations?
--
Sean M. Loftus
Enterprise Architect
Loftus Consulting, Inc.
www.LoftusConsulting.com
sean(removeme)@loftus.org Tag: Script to get my public ip address Tag: 176463
Hostname
Sorry if this is a stupid question, but how can I return a win2000/xp
hostname?
I'm running a script that scans an IP range, then checks for OS + SP
compatibility before running a command against those computers meeting the
requirements. The ip addresses and results are logged to an excel file, but
as the pc's are on a dhcp network the log file soon becomes meaningless.
I assume it's possible to return the contents of a cmd window but this seems
to be an unnecessarily complicated route.
Thanks
Pete Tag: Script to get my public ip address Tag: 176460
A newbie seeking some answers hopefully!
Hi and thanks for existing! I didn't know this kind of help existed! Now
that I found Newsgroups, I plan on being around for some time! Anyways, I
am new to scripting and I am trying to sharpen up my skills. I've created a
script that sort of automates a few programs for me. It works well but now
that I finally got this to work, I want to add more as well as learn more!
Down below is part of my code. I didn't want to post the whole code just
parts that pertain to the questions I am asking.
------------AutoPrograms.vbs----------------------------------------------
Dim Menu, WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup"Please Select ""1-9"" For Your Program To Run. " &_
"Or Select 10 To Shut Off Computer.",,"Program Runner"
Menu = InputBox("Please select a number 1 - 9 please."& VbCrlf & Chr(13)&
Chr(10)&_
"1 = UltraEdit"& VbCrlf & "2 = PrimalScript"& VbCrlf & "3 = LimeWire" &
VbCrlf &_
"4 = MusicMatch"& VbCrlf & "5 = FrontPage"& VbCrlf & "6 = Nero" & VbCrlf &_
"7 = Windows Media Player"& VbCrlf & "8 = Tag&Rename"& VbCrlf & "9 = "&_
"Outlook Express" & vbcrlf & VbCrlf & "" & _
"*10 = Computer Shutdown" & Chr(13) & Chr(10) & VbCrlf & "*By selecting
""10"" you" &_
" can shut down the computer.","Program Runner")
'The Menu is programs i mostly use.
If Menu = 1 Then
longname = "C:\Program Files\IDM Computer
Solutions\UltraEdit-32\uedit32.exe"
CreateObject("WScript.Shell").Run Chr(34) & longname & Chr(34)
ElseIf Menu = 2 Then
longname = "C:\Program Files\SAPIEN\Primalscript\PrimalScript.exe"
CreateObject("WScript.Shell").Run Chr(34) & longname & Chr(34)
ElseIf Menu = 3 and so on
rem and so on
rem and so on...
ElseIf Menu = 10 Then
ianswer = msgbox("Windows Will Now Shut Down.", _
vbOkCancel+VbInformation, "Option 10")
rem 1st question: How would I add a "that number isn't an option!" if
supposed any other number is entered except 1-10?
If ianswer = vbOk Then
Set wmi = GetObject("winmgmts:{(Shutdown)}")
Set objset = wmi.instancesof("win32_operatingsystem")
For each obj in objset
Set os = obj : exit For
Next
Const EWX_POWEROFF = 8
os.win32shutdown EWX_POWEROFF
Else
MsgBox "You chose not to shut down windows.", VbOkOnly+64, "Program
Runner"
rem here is question 2:
rem how would I, if I selected not to power down start the menu message
again? I'm not sure but I think I would us "loop" rem right? Like I said I
am learning so bare with me please! Thank you in advanced!
End If
End If Tag: Script to get my public ip address Tag: 176440
Internet usage!
Hello....
how can I know that a specfic user uses the Internet, so that when he
stops using the Internet, I'll stop my running script? Tag: Script to get my public ip address Tag: 176436
How can i get my public ( firewalls public ) ip address with vbscript? I
mean if i connect any local area network how can i get those lan's public
ip?