Starting external Programm with VBScript
Hallo NG,
is it possible to start an external programm with vbscript.
For exampal:
Run "C:\MyProgramm.EXE /e"
Thanks, Ahmed Tag: mail-enabled a global security group Tag: 179423
Applying Windows patches via VB
I have been trying to find a suitable script to deploy the Hotfix KB899588
across my domain, via group policy
As yet i haven't found a script that works.
Any body have such a script or know a good site for help??!! Tag: mail-enabled a global security group Tag: 179421
wscript.exec in hidden window?
With wscript.run there is an argument that lets you run the
command invisibly but there does not appear to be the same
argument available with wscript.exec. I need to run a
command and capture its stderr (although I don't need the
stdin and stdout) and wscript.exec lets me do that except
for the annoying flashing of the command window which
is doubly annoying in my application since I have to
perform wscript.exec on several commands in succession
and the screen just goes crazy.
I would prefer to keep my application self contained (its
currently one .hta file) and would prefer not to have to
use temporary files if I don't have to.
Is there a way to handle this? Tag: mail-enabled a global security group Tag: 179413
Copying Folder Contents
Hi
I haven't the slightest idea about scripts, I have been trying to write a
batch file to do the job, with no success and I have been informed that a
script is what I need.
Here is my predicament:
This action needs to work in an NT and XP environment
I need to move files at the end of ever month stored in 2 different folders,
to a backup location.
For example this is where the files are located:
p:\cmanger\{Workstation_name}\Dailydoc
p:\cmanger\{Workstation_name}\DailyImg
I would like all the files within the 2 folders all moved to
p:\cmanger\backup\DailyDoc & p:\cmanger\backup\DailyImg
Which should then leave the original file locations empty.
However each workstation I need to perform the action on has a different
folder name in the middle.
It's always the workstation name, if this helps?
Is it possible to write a script to automatically perform this action at the
end of each month.
If so, would it also be possible to move them to a folder of the time period
i.e. named "yyyymmdd" each time the script runs.
Your expert help on this would be most appreciated.
Regards,
Bradley Tag: mail-enabled a global security group Tag: 179405
Opening Ports and allowing exceptions
Hello all,
I am new to scripting. So any detailed information would be greatly
appreciated,
From the script, WinFire-com.vbs from Microsoft,
arrNewPorts(0,0) = "FPS" 'Name
arrNewPorts(0,1) = 137 'Port
arrNewPorts(0,2) = NET_FW_IP_PROTOCOL_TCP 'Protocol
arrNewPorts(0,3) = NET_FW_SCOPE_ALL 'Scope - default is NET_FW_SCOPE_ALL
arrNewPorts(0,4) = True 'Enabled - default is True
Regarding the scope, how can I change this so that the port is open for a
range of addresses, say:
10.91.12.56,10.7.14.9/255.255.255.0,10.116.45.0/255.255.255.0
Further, from the same script,
Const NET_FW_IP_PROTOCOL_TCP = 6
Const NET_FW_IP_PROTOCOL_UDP = 17
How do we know that TCP is 6 and UDP, 17. Where do these numbers come from?
The two number, 6 and 17, reappear in each script I've seen. I want to know
how we know that 6 corresponds to TCP and 17 corresponds to UDP. If you could
refer me to documentation that I can read, that would be great!
One more question, how can I say the port is open for all protocols (TCP and
UDP)? Do have to to do two port openings? One for TCP and another for UDP?
I appreciate your help! Thank you in advance! Tag: mail-enabled a global security group Tag: 179402
launch app and pass file name to open
I need some help trying to launch an application and pass a file name to it
for viewing when opened
the "cmd" is correctly capturing the arguments and application path, but
does not open the application
------ code -----
<SCRIPT Language="VBScript">
Dim Args, FileName,vApp,cmd
Set WshShell = CreateObject("WScript.Shell")
Args = Split(objHTAGetTools.commandLine, chr(34))
FileName = Trim(Args(1))
vApp="C:\Progra~1\Micros~1\v0.6.812\WebMatrix.exe"
cmd = "cmd /c " & " """ & vApp & """ " & " """ & FileName & """ "
'msgbox cmd
Call WshShell.Run (cmd , 1, TRUE)
... Tag: mail-enabled a global security group Tag: 179398
AD Group Access Rights
Hi All,
Is there a way to determine with scripting, the access rights that various
groups in AD have? If so, can someone point me in the right direction.
Thanks,
Bob Tag: mail-enabled a global security group Tag: 179395
Checking for Empty Folders
Hi, i would like to be able to run through a folder on my network looking
for empty folders and output this information to a txt file, really new to
scripting
what i have is a shared dir on my network called clients, this contains
subfolders a-z and these contain subfolders A100.....A500 - Z100...Z500
under each client folder A100 etc i there are other folders, i would like to
be able to check these to see what folders are empty for each client
i do not need to be able to run through the whole drive at once, even doing
it letter by letter would be fine
i would appreciate it if someone could point me in the right direction or a
good web site for info
thanks Tag: mail-enabled a global security group Tag: 179392
Elevate user during logon process
I would like to know if anyone has had success elevating a user during the
logon process and if so what they used to elevate that user?
I would like to be able to elevate a user to admin rights, install one or
several programs and then remove the admin rights.
Anyone have any ideas as to which direction would be best?
Thanks
Tom Tag: mail-enabled a global security group Tag: 179391
wireless
I need some guidance in deploying preferred networks using vbscript . I have
a script that add a ssid and the other settings to the registry, but i cannot
see it in "prefered networks". This script should activate the checkbox "Let
windows manage...".
This is what i have:
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
'Get the id of the wireless NetworkCard
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\13"
strValueName = "ServiceName"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "networkcard id Value: " & strValue
'Create key with the id
strKeyPath = "SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces\" & strvalue
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'Add a binaryvalue with the settings of the wireless conection
BinaryValueName="1"
iValues=Array(&H05,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H40,&H0d,&H00,&H00,&H00,&H04,&H00,&H00,&H00,&H65,&H2d,&H55,&H4d,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H0d,&H00,&H00,&H00,&H28,&H00,&H00,&H00,&H00,&H00,&H00,&H00,&H28,&H00,&H00,&H00,&H05,&H00,&H00,&H00)
oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
BinaryValueName,iValues
If someone can point me in the right direction I would appreciate it. Tag: mail-enabled a global security group Tag: 179390
HOWTO: Raise C# event and handle in VBScript
The event SomeEvent() is raised and handled in VB6 fine. Using this exact
same code and using VBScript with the CreateObject call causes an error in
the c# code.
When using VBScript, I get a 'Object reference not set to an instance of an
object.' on the line SomeEvent(). I am positive the m_nSomeProperty =
nValue; line executes.
How can I get this working from VBScript?
Here's the code:
using System;
using System.Runtime.InteropServices;
namespace ComInterop
{
public delegate void SomeEventHandler();
[ Guid("F8E81A5A-BB37-49CC-9681-7D4FE52936B3"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch) ]
public interface ICComInteropEvents
{
[DispId(1)] void SomeEvent();
}
[ Guid("97C8501B-35DE-48CA-BECC-B980D08226F4"),
InterfaceType(ComInterfaceType.InterfaceIsDual) ]
public interface ICComInterop
{
[DispId(2)] void SomeMethod( int nValue );
[DispId(3)] int SomeProperty{ get; set; }
}
[ Guid("10EBC493-D2FD-4723-9F8B-F593586ED9B7"),
ProgId("ComInterop.CComInterop"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ICComInteropEvents)) ]
public class CComInterop : ICComInterop
{
public CComInterop() : base()
{
}
private int m_nSomeProperty = 0;
public event SomeEventHandler SomeEvent;
public void SomeMethod( int nValue )
{
m_nSomeProperty = nValue;
///////////////////////////////////////////////////////////////////////////////////////////
//
// object reference not set to an object error occurs here
//
//////////////////////////////////////////////////////////////////////////////////////////
SomeEvent();
}
public int SomeProperty
{
get{ return m_nSomeProperty; }
set{ m_nSomeProperty = value; }
}
}
}
And the VBScript code:
Option Explicit
' ==========================================================================
' Implementation
'
' ==========================================================================
Dim objReceive
Dim bDone
On error Resume Next
bDone = false
WScript.Echo "CreateObject"
Set objReceive = CreateObject("ComInterop.CComInterop")
if Err.Number <> 0 then
WScript.Echo "Error: CreateObject: " & Err.Description
else
objReceive.SomeMethod(7)
if Err.Number <> 0 then
WScript.Echo "Error: Setting SomeMethod: " & Err.Description
else
WScript.Sleep 3000
end if
end if
objReceive = nothing
WScript.Echo "Program Over"
' ==========================================================================
Sub objReceive_SomeEvent()
WScript.Echo "Message: " & objReceive.SomeProperty
bDone = true
End Sub
--
Dan Sikorsky, MSCS BSCE BAB Tag: mail-enabled a global security group Tag: 179389
testpage
Hello,
I added a new IP network printer to my OU with a logon script and i set it
up as the defaut printer. I would like to be able to create a script to able
to print a test page to the printer from the logon.
--
The only easy day was Yesterday Tag: mail-enabled a global security group Tag: 179383
vbs script is blocked by anti-virus software
After all of you helped me a lot with my last question (thanks again,
everything worked great!), I'm again without any idea!
Now I have my complete .vbs script that tests the installed Windows
version and the installed Adobe Reader Version.
I've burned it to a CD with a Autorun.inf that looks like this:
[autorun]
shellexecute = cscript.exe VersionCheck.vbs
My problem: On almost every computer the script is blocked as a
'dangerous virus' by the anti-virus software.
What can I do? I thought of maybe converting it to exe and as I googled
that seems to be good solution if you have VB what I don't have!
Is there an other way to make the script run? It won't be send by email
it will just be on a CD!
Any hint? Thanky you very much! Tag: mail-enabled a global security group Tag: 179381
onFileDateChange handler from a COM object?
Is there any COM way, besides polling, that will let me know when a
specific file's date has changed (I know that winternals is supposed to
have a filemon app, but if possible I'd like to do this using already
available objects/code)?
Motivation. I'm developing an application which stays in the
background and does its thing. If I rewrite (that is to say, edit) my
app, I'd like to have the current running instance exit and a new
instance start up (actually, the order will be reversed, to ensure the
revised app is at least breathing). That's it. One save from me
should be enough to cause a reload. Isn't there a nice event driven
way for the running app to be notified when its own file has changed? -
maybe some file system object has an event whenever any file in its
directory changes?
Thanks for any tips,
Csaba Gabor from Vienna Tag: mail-enabled a global security group Tag: 179379
how to rename a active directory user
Hello,
I search for a way to rename the "name" field or the "cn" of a user object
in active directory using a VBS.
Is there any way to do so?
Regards
Stefan Tag: mail-enabled a global security group Tag: 179378
Execute code before closing script
Hello
I have a script that runs 24/24 7/7 on a server in an constant loop
gathering information into a DB. What i would like (and don't know how) is to
execute code to 'compact & repair' the database every time the server
shutsdown/reboots. So, the question is, is there any way to do this with
scripts, that is, to bypass the endless loop, executes final code and shuts
itself down without being forced?
Suggestions/links are welkome.
Greets
Davor Tag: mail-enabled a global security group Tag: 179375
Can't read a registry key
I've created a template script to read IP addresses from a list, then carry
out simple tasks such as read RAM, Host name, etc. which works absolutely
fine for whatever info I'm trying to gather and send to an output file.
Basically I'm just cut and pasting the main body of a script into my
template. I've now tried to adapt the script to read a registry key, but the
script returns no value for the registry key. The script is as follows -
On Error Resume Next
Const INPUT_FILE_NAME = "Addresses.txt"
Const FOR_READING = 1
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
Do While objfile.AtEndofStream <> True
strComputers = objFile.Readline
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputers & "\root\cimv2")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
Set cPingResults = objWMIService.ExecQuery("SELECT * FROM Win32_PingStatus
WHERE Address = '" + strComputers + "'")
For Each oPingResult In cPingResults
If oPingResult.StatusCode = 0 Then
WScript.Echo VbCrLf & strComputers & " responded to ping."
Set colCompSystems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCompSystem In colCompSystems
WScript.Echo "Host Name: " & LCase(objCompSystem.Name)
Next
strKeyPath = "SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc."
strValueName = "PatternVer"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwvalue
Wscript.Echo "Current Pattern Version - " & dwvalue
Else
WScript.Echo VbCrLf & strComputers & " did not respond to ping *Target
Possibley Down.!*."
End If
Next
Loop
objFile.Close
IP address and Host name are displayed fine, and will also echo the "current
pattern version" line, but gives no value.
I created a simpler version of script to run on my local machine which goes -
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc."
strValueName = "PatternVer"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwvalue
Wscript.Echo "Current Pattern Version - " & dwvalue
This returns the value that I'm looking for no problem, so I'm confident
that the code is ok.
I'm guessing it's something to do with syntax as opposed to code. Can
anyone help? Tag: mail-enabled a global security group Tag: 179374
WMI script
I use a script to see if an application is running on a remote machine, this
works fine as long as the service "windows firewall/ICS" is not started, MS
offers an solution
"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/connecting_through_windows_firewall.asp"
but it doesn't work for me. Can anyone help me..? Tag: mail-enabled a global security group Tag: 179373
object required 'Wscript"
when trying to run this code in an hta file I keep getting the error :
--- object required "Wscript" ---
what's causing this error ??
====== code ======
<html>
<head>
<title>HTA Tools</title>
<HTA:APPLICATION
ID="objHTATools"
APPLICATIONNAME="Tools"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<SCRIPT Language="VBScript">
Set WshShell = CreateObject("WScript.Shell")
Set Args = WScript.Arguments '<== error on this line
If Args.Count >= 1 Then
vPath = Args(Args.Count-1)
End if
...... Tag: mail-enabled a global security group Tag: 179369
WshScriptExec Status issue
Hi,
Anyone have any ideas why the following code snippet will never exit the
status polling loop? The only way I can get it to break out of the loop is by
uncommenting the readline statement. Has me a little puzzled.
Cheers
Kristian
---
Set g_oShell = WScript.CreateObject("WScript.Shell")
Set g_oExec = g_oShell.Exec("cmd /c dir %windir%")
Do While g_oExec.Status <> 1
' g_oExec.StdOut.ReadLine()
WScript.Sleep(50)
Loop
WScript.Echo vbNewLine
WScript.Echo g_oExec.StdOut.ReadAll() Tag: mail-enabled a global security group Tag: 179366
Event in WMI
When I register some events (event consumers & event filters) to WMI
repository, process 'wmiprvse.exe' (Wins XP) or 'winmgmt.exe' (Wins 2K)
occupies lot of CPU all the time.
Is there anyway to reduce these process' percent of occupation of CPU? Tag: mail-enabled a global security group Tag: 179364
Chart Type Info
Hello everybody,
Posting for the first time. I am using Vb Scripting to generate some
charts based of data from SQLServer. I was able to get all the charts
displayed properly. However, I have a question with regards to way how the
lines in the charts are being displayed.
I will try to explain my problem using excel terminology. Lets say for the
grid of values shown below,
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
12 34 08 45 19 23 33 17 53 23 11 09
It plots the graph normally. But if the values are like this:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
12 34 08 45 23 33 17 23 11 09
The places where the values are not there, the chart is defaulting to zero,
which I don't want. I want the line chart to end at April and then continue
from June and end at August, then continue from October.
I tried several different chart type values, but didn't get the
functionality I was looking for. Does anyone have any ideas to resolve this
issue?
Thanks,
Prasad Yarlagadda Tag: mail-enabled a global security group Tag: 179360
Close Specific Application
Hi Folks,
Can I close a specific application knowing only its executable name?
I need it to be closed in a correct way, not the "terminate" kind of
way, something similar to pressing the [X] button.
How?
Right now I can only close an application through "Sendkeys %{F4}", but
I can't tell if the application I'm closing is the one I want to close.
Regards,
--
Beto Tag: mail-enabled a global security group Tag: 179356
Create a "SUB CHILD" for XML File
Not sure exactly how to do, I have the XML file being created, but I am
missing a node that should have the other elements as "SUB CHILD" under it -
the file should look like
<?xml version="1.0" encoding="utf-8" ?>
- <ImportPayments>
- <Payment>
<ReceiptType>1</ReceiptType>
<ReceiptMethod>2</ReceiptMethod>
<ReceiptRef>1834</ReceiptRef>
<ReceivedFrom>1</ReceivedFrom>
<AccountNumber>6116242</AccountNumber>
<Amount>191.8</Amount>
<BankAccountID>12</BankAccountID>
<DeclineReinstatement>0</DeclineReinstatement>
</Payment>
</ImportPayments>
But mine looks like - I am missing the PAYMENT Node - can anyone tell me how
to get that added or am i just being totally stupid - I would lean toward
the latter LOL - Below is a copy of the script
<?xml version="1.0" encoding="utf-8" ?>
- <ImportPayments>
<ReceiptType>1</ReceiptType>
<ReceiptMethod>2</ReceiptMethod>
<ReceiptRef>1834</ReceiptRef>
<ReceivedFrom>1</ReceivedFrom>
<AccountNumber>6116242</AccountNumber>
<Amount>191.8</Amount>
<BankAccountID>12</BankAccountID>
<DeclineReinstatement>0</DeclineReinstatement>
</ImportPayments>
Dim xmlDoc, rootEl, p
Dim fieldReceiptType, fieldReceiptMethod, fieldReceiptRef, fieldReceivedFrom
Dim fieldAccountNumber, fieldAmount, fieldBankAccountID,
fieldDeclineReinstatement
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.preserveWhiteSpace = True 'Create a root element and append it to
the document
Set rootEl = xmlDoc.createElement("ImportPayments")
xmlDoc.appendChild rootEl
Set fieldName = xmlDoc.createElement("Payment")
Set fieldReceiptType = xmlDoc.createElement("ReceiptType")
Set fieldReceiptMethod = xmlDoc.createElement("ReceiptMethod")
Set fieldReceiptRef = xmlDoc.createElement("ReceiptRef")
Set fieldReceivedFrom = xmlDoc.createElement("ReceivedFrom")
Set fieldAccountNumber = xmlDoc.createElement("AccountNumber")
Set fieldAmount = xmlDoc.createElement("Amount")
Set fieldBankAccountID = xmlDoc.createElement("BankAccountID")
Set fieldDeclineReinstatement = xmlDoc.createElement("DeclineReinstatement")
fieldReceiptType.Text = "1"
fieldReceiptMethod.Text = "2"
fieldReceiptRef.Text = "1834"
fieldReceivedFrom.Text = "1"
fieldAccountNumber.Text = "6116242"
fieldAmount.Text = "191.8"
fieldBankAccountID.Text = "12"
fieldDeclineReinstatement.Text = "0"
rootEl.appendChild fieldReceiptType
rootEl.appendChild fieldReceiptMethod
rootEl.appendChild fieldReceiptRef
rootEl.appendChild fieldReceivedFrom
rootEl.appendChild fieldAccountNumber
rootEl.appendChild fieldAmount
rootEl.appendChild fieldBankAccountID
rootEl.appendChild fieldDeclineReinstatement
'Add an XML processing instruction
'and insert it before the root element
Set p=xmlDoc.createProcessingInstruction("xml","version='1.0'")
xmlDoc.insertBefore p,xmlDoc.childNodes(0)
'Save the XML file to the c directory
xmlDoc.Save "c:\trash\test.xml"
'Release all object references
Set xmlDoc = nothing
Set rootEl = nothing
Set fieldReceiptType = nothing
Set fieldReceiptMethod = nothing
Set fieldReceiptRef = nothing
Set fieldReceivedFrom = nothing
Set fieldAccountNumber = nothing
Set fieldAmount = nothing
Set fieldBankAccountID = nothing
Set fieldDeclineReinstatement = nothing
Set fieldName=nothing
Set p = nothing Tag: mail-enabled a global security group Tag: 179352
IPPrinter Script is not workding VBS
clients all work on XP machines,and we do direct IP printing. Setting
up a print server is not an option I want the script to add the IP
port, driver, and printer object. If the machine already has the driver
it works fine but if not, I get the same error message: Line 34; char
1; error: Generic failure; code 80041001; source SWbemObjectEx
here is my script where am i going wrong?
strOutput = ""
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_192.168.79.200"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.79.200"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
strOutput = "Printer port IP_192.168.79.200 was created." & VBNewLine
strComputer = "."
sDir = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "Xerox WorkCentre M55"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = sDir + "\Xerox WorkCentre M55 PCL "
objDriver.InfName = sDir + "\\Xerox WorkCentre M55 PCL\XRB55PCL.INF"
intResult = objDriver.AddPrinterDriver(objDriver)
strOutput = strOutput & "Printer Driver for the Xerox WorkCentre Pro 55
printer was installed. Code: " & intResult &
VBNewLine
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "Xerox WorkCentre M55"
objPrinter.PortName = "IP_192.168.79.200"
objPrinter.DeviceID = "Xerox WorkCentre M55"
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.ShareName = "Xerox WorkCentre M55"
objPrinter.Put_
WScript.Echo strOutput & "Xerox WorkCentre M 55 printer was installed." Tag: mail-enabled a global security group Tag: 179351
Crypt API dll in VBScript ASP
I found this bit of code from www.allapi.net on how to use the windows
api to do some basic encryption. It works great so I created a dll of
the code so I could use it in different applications. So far it has
been working great with no problem, until now.
I tried to use the dll from a vbscript asp page to encrypt some
information that is being passed to the server. I call the dll just
like any other dll
set variable=server.createobject("DLLName.ClassName")
but when I try to use the dll it never returns the encrypted data. I
have put in code into the dll to log that it gets initialized and
nothing shows in the log. I also created another dll, very simple with
only one function, and it works fine.
I have this feeling that it might be security related because the dll
calls the advapi.dll and kernel in some of its function calls. I have
set permissions for IUSR_machine to have full access to the entire
machine, is there something else I should try?
Any help any of you fine folks out there can give would be greatly
appretiated.
Thanks,
Adam Tag: mail-enabled a global security group Tag: 179350
VBScript Documentation
I search on the web for good example of VBScript and also for
explication on the Scripting.FileSystemObject. If any body had i good
site to visit for good example . Tag: mail-enabled a global security group Tag: 179348
Logoff Script
We want to put a script as a schedule task on a windows XP SP2 that will log
a user off a certain time at night. Does anyone have a script like that?
Thanks,
Eric Sabo
sabo_e@cup.edu Tag: mail-enabled a global security group Tag: 179346
.Net security
Hi,
I'm looking to change permission in .Net security for my local intranet
traffic. Does anyone have suggestions as to how I may do this?
Thanks in Advance,
JeffH Tag: mail-enabled a global security group Tag: 179343
WMI impersonation on local machine
hello,
why I cannot impersonate script caller on the same machine when using WMI?
is there
a method to do it?
I do this with sortcuts, but the script runs only under Network Service
account and not under the caller's account.
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("select * from Win32_ShortcutFile
where name like 'c:\\h%'")
For Each objItem in colItems
Wscript.Echo "target: " & objItem.Target
Next
:
O. Tag: mail-enabled a global security group Tag: 179342
Help with InvokeVerbEx needed
The following is a direct quote for the Windows 2000 Scripting Guide
<begin quote>
Be aware that verbs always function in exactly the same way they do
when clicked in Windows Explorer. If you right-click a file and select
Open, the file automatically opens. If you select Delete, however, a
confirmation box is displayed before the file is deleted. This same
confirmation box appears if you attempt to delete any object using
InvokeVerbEx. For example, using the Delete verb on a file results in
a dialog box similar to the one shown in Figure 11.8.
By comparison, right-clicking a file and selecting Print does not
display a dialog box; instead, the file is automatically printed to
the default printer. If you use InvokeVerbEx to print a file
programmatically, that file is automatically printed to the default
printer without displaying a dialog box of any kind.
</end quote>
And here is the sample code:
TargetFolder = "C:\Logs"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.Namespace(TargetFolder)
set colItems = objFolder.Items
for each objItem in colItems
wscript.echo objItem.Name
objItem.InvokeVerbEx("Print")
next
Contrary to what is printed a dialog box DOES appear for "every" file
print. I can not seem to find any information on the optional
parameter.
Does anyone know of a way to make InvokeVerbEx perform as documented -
I want to invoke the print verb on a file without any user
intervention.
Thanks
Lee Tag: mail-enabled a global security group Tag: 179336
Binding to a user principal name in ad
Hi all:
I am looking for a way to bind to a user in AD by using the User Principal
Name (Which I believe is the field on the Account tab Called User Login
Name). Now I am using the code below which correctly binds to the AD user if
the Display name is the same as the UPN but it will not bind if the Display
name is set to last name, first name. When the script runs correctly it then
updates the description field for the user, disables it and then moves it to
a deletions OU, but if I cannot bind to the user then it will not do all of
this stuff.
EX1
Display Name = aa123
UPN = aa123
works correctly binds and script continues if user enters aa123 user into
code below
EX2
Display name = Doe, John
UPN = aa123
does not find or bind to the user if you enter aa123 - script error
EX3
Display name = Doe, John
UPN-aa123
does find the user if you enter doe, john but the script will not update the
description field for the user or the rest of the .
Set objUser = GetObject _
("LDAP://cn="& getuser &",OU=users,OU=MANAGED DESKTOP
SERVICES,OU=HHH,DC=aa,DC=abc,DC=com")
where getuser is an input from a html form
Any suggestions on how to bind to the UPN as most of our users have ad id
that is not their last name, first name. Thanks Tag: mail-enabled a global security group Tag: 179329
regex problem
Hi,
as I couldn't find any newsgroup specialized on regex, I hope
somebody here can help me.
I have the following kind of strings:
file/start.asp#en:test>top
file/start.asp?load=http:/www.test.com>top
file/test.asp?load=http://www.test.com#en:test;de:test>top
With the following regex I can extract the things I need (everything
between 'en:'..and the last ; or 'top' or the uri's:
((.*)[(/|\\)])(.*\.asp)(\?load=(.*)#)?((.*;en:(.*));)?(>(.*)$)?
But additionally the whole thing can start with http:// or ftp://, e.g.
http://www.start.com?load=http:/www.test.com>top
http://www.start.com?load=http:/www.test.com#en:test;>top
...
But when I modify it like this:
(http://.*|ftp://.*)|((.*)[(/|\\)])(.*\.asp)(\?load=(.*)#)?((.*;en:(.*));)?(>(.*)$)?
it only matches the whole string and doesn't split it.
Maybe anybody has got a clue, I'm a bit stuck with that a the moment.
Best regards,
Andi Tag: mail-enabled a global security group Tag: 179320
Change the pwdLastSet value
I need to change the pwdLastSet attribute on accounts in Active
Directory. I found this script which will change the value to 0 which
means the user must change their password at next log on. But we are
implementing a new pwd policy to force users to change their pwd after
180 days. Most of our users pwd's are older than that and we don't want
them all expiring on that day. So, I need to be able to bulk set the
pwdLastSet value to %today's date%.
Here is my idea:
set oUser = GetObject("LDAP://cn=user,ou=test,dc=domain,dc=com")
oUser.Put "pwdLastSet", CLng(127703193192000000)
oUser.Setinfo
(We reverse engineered the Integer 8 number to be approx Sept 1, 2005,
hence the value 127703193192000000)
But when I run this I get an error Overflow: 'CLng'
Has anyone ever done this before? Setting the pwdLastSet value to
something other than 0? Tag: mail-enabled a global security group Tag: 179315
.net dll with asp
hi all,
i have created a dll with vb.net, so to use it from both asp.net that pure asp
i have tested it in pure asp pages with iis 5.0, and it works.
Now i have to move it on IIS 6.0, but when i launch the asp file i have the
following error:
File or assembly name testVB, or one of its dependencies, was not found.
i've done the same things both on the machine with iis5 that the one with
iis6...
can anyone help me? Tag: mail-enabled a global security group Tag: 179310
Export list of users to excel speadsheet
Hi,
I am a newbie to scripting so be gentle with me ;-)
I have been asked to export a list of all users from our domain into an
excel spreadsheet. Data must include the following: Logon name, Email
Address, Telephone Number. Our users are in multiple OUs depending on their
office location so the script must search the whole domain.
Can you help? Please highlight the parts which need to be modified...
Many thanks,
Don Pedro Tag: mail-enabled a global security group Tag: 179307
script to duplicate the content management system
Hello,
I want a script which duplicates the content management system with all the
files and the associated permissions. Can any one please help me with this.
Thanks
Arvind Tag: mail-enabled a global security group Tag: 179303
Modification of Inbox field formula in Outlook 2003
In Outlook 2003 I have an "email age" field with the following formula:
DateDiff("h",[Received],Now()) & " hours " & DateDiff("d",[Received],Now())
& " day(s) old"
How can I modify the formula such that it does what this pseudo-code
suggests?
If DateDiff("minutes",[Received],Now()) < "59 minutes" Then
DateDiff("minutes",[Received],Now()) & " minutes old"
ElseIf DateDiff("h",[Received],Now()) < "24 hours" Then
DateDiff("h",[Received],Now()) & "hours old"
Else
DateDiff("d",[Received],Now()) & & " days old"
End If
End If
Thanks!
J.S.
-- Tag: mail-enabled a global security group Tag: 179302
Check if registry registry key exists and then add values to runonce
Hi all,
I have done some scripting but I am no expert. I need to check if a registry
key (not a string value) exists on a client computer. If the key exists it
should add some value to the HKCU runonce hive. If the key does exists it
should do nothing and run the rest in the script.
How do I do that?
Bye
Mariette Knap
www.smallbizserver.net Tag: mail-enabled a global security group Tag: 179301
Moving the Windows Taskbar via script
Hi
I was just wondering if anyone has any idea of how to move the windows
taskbar through vbscript (or any other non-manual method for that
matter).
The reason for this is that I have a friend who logs on to a university
network. Every time he logs on, the display settings are defaulted to
have the taskbar docked on the bottom of the screen. He prefers to
have it docked on the top of the screen. No personal display
preferences are saved between sessions.
I have been scouring google for a few days now and I'm running out of
ideas.
Any help is appreciated,
Tim Tag: mail-enabled a global security group Tag: 179296
Make a html Drop Down list behave like a vb Combo Box
Hi,
I am currently working on an Intranet based payroll tool, which
interfaces with our Payroll system, I am currently working on an
expenses claim screen, based on ASP, HTML and vbscript (we have a
totally IE based client base) I have been asked to make some drop down
lists behave much the same as a Win32/vb type combo box, however I am
struggling with this. I want the drop down list to filter the contents
much the same as a combo box. for example if a user wants to find the
payroll number 001934, they would simply type it into the drop down
list and it moves its way to this value rather than the way drop down
lists work in a browser ie. the brower would move to the first number
starting with zero, then to the next number starting with zero, then
the first number starting with 1 etc.
Any help would be greatly appreciated with this. If a Javascript
solution is all you have then please let me have it, I am at the point
of desperation now.
Thanks to everyone in anticipation of your help
Simon Tag: mail-enabled a global security group Tag: 179295
Username, find the computer
Hi all,
having only the Username from a person, with which the person will login to
a domain. Is it possible to find the computer to which the person is
currently logged on, using LDAP or ADSI? Tag: mail-enabled a global security group Tag: 179292
CPU, Increase Percentage
Is there a way to dictate how much of the processor's time is given to a
script? My scripts normally do a lot of database accessing, so it's not
uncommon to pin the CPU. I have one scrpt that when run, stays down around 1
or 2% of the processor usage. At that rate it takes 20 minutes to run.
Any ideas on how to get it more of the CPU?
Note: During this time, the System Idle Process is runing above 90%.
Thanks,
Bernie Tag: mail-enabled a global security group Tag: 179291
http://username:password@domain
I have made the changes in my registry that are documented in many places,
and in Internet Explorer 6 the command http://username:password@domain now
works just fine.
However, I now want to open the same page with a script, going thru the
InternetExplorer object and Navigate (or whatever is appropriate). My
problem is that Navigate will not accept http://username:password@domain as a
url, which is I suppose not surprising. MY QUESTION, THEN, IS HOW DO I OPEN
THIS PAGE?
i suspect that I have to do something with ... As Variant, but I do not
understand the syntax or the semantics.
Thanks in advance for any help. Tag: mail-enabled a global security group Tag: 179288
Import NS bookmarks script
Is there any way by using some sort of script to import netscape bookmarks
into IE? We are moving away from Netscape in our organisation, it would be
save alot of time if we could automatically do the import say throuogh a
login script then to walk to every machine and run the IE import wizard.
thanks Tag: mail-enabled a global security group Tag: 179287
Converting an "xls" file to "pdf" file by using "FreePDF XP"
I have searched many sites but there is no such example for converting
an "xls" file to "pdf" file by using "FreePDF XP". So I re-write the
code from "FreePDF XP ResourceKit" and share it here for anyone needs.
Please install "FreePDF XP" before running this script. "FreePDF XP"
can be downloaded at
http://freepdfxp.de/fpxp.htm
----------------------------------8<---------------------------------
'**********************************************************************
'*
'* Author: Curtis Wong
'* File: xls2pdf.vbs
'* Created on: 15 August 2004
'*
'* Aim: To convert "xls" to "pdf" format by using FreePDF
'*
'**********************************************************************
Option Explicit
' Check if this script is run by "cscript.exe"
If Not IsHostCscript Then
Const kMessage1 = "Please run this script using CScript."
Const kMessage2 = "This can be achieved by changing the default"
Const kMessage3 = "Windows Scripting Host to CScript using:"
Const kMessage4 = """CScript //H:CScript //S""."
WScript.Echo kMessage1 & vbCRLF & vbCRLF & kMessage2 & vbCRLF & _
kMessage3 & vbCRLF & vbCRLF & kMessage4
WScript.Quit
End If
' To make this script can be run once at each time
Dim OneInstance, strWQL
strWQL = "SELECT name from win32_process where" & _
" name='wscript.exe' or name='cscript.exe'"
OneInstance = GetObject("winmgmts:").Execquery(strWQL).Count
If Trim(CStr(OneInstance)) <> "1" Then WScript.Quit
' Main part
Dim objFSO
Dim RptDir, CurDir, RptName, objRpt
' Define the Current Directory
Set objFSO = CreateObject("Scripting.FileSystemObject")
CurDir = objFSO.GetParentFolderName(Wscript.ScriptFullName)
If Right(CurDir, 1) = "\" Then _
CurDir = Left(CurDir, Len(CurDir) - 1)
' Define the variables for output reports
RptDir = CurDir
' Add into the following array for the reports needed to convert
' to "pdf" format. Note that filename only, ".xls" is NOT required
RptName = Array("book1")
For Each objRpt in RptName
XLS2PDF objRpt
Next
Msgbox "The conversions are finished.", vbOKOnly + vbInformation, _
"Congratulations"
Set objFSO = Nothing
'**********************************************************************
'*
'* Sub XLS2PDF(ByVal Workbookname)
'* Purpose: Convert Excel Worksheet to pdf
'* Input: Workbookname <Name of Excel Workbook>
'*
'**********************************************************************
Private Sub XLS2PDF(ByVal Workbookname)
Dim psFile, objExcel, OldPrinter
psFile = CurDir & "\" & Workbookname & ".ps"
Wscript.Echo "Converting """ & Workbookname & ".xls"" -> """ & _
Workbookname & ".pdf"""
' Create Excel Object
Set objExcel = CreateObject("Excel.Application")
With objExcel
' Open workbook
.Workbooks.Open RptDir & "\" & Workbookname & ".xls", 0, True
' Open the workbook implicitly
.Visible = False
' Check if it is a blank workbook
If .Worksheets(1).UsedRange.Address = "$A$1" And _
.Worksheets(1).Range("A1") = "" Then
.Workbooks(Workbookname & ".xls").Close False
.Quit
Set objExcel = Nothing
WScript.Echo Workbookname & ".xls is a blank workbook."
WScript.Quit
End If
' Print all worksheets in the opened workbook
' (Comment the following if you only want to print some
' worksheets)
.Workbooks(Workbookname & ".xls").PrintOut _
, , , , "FreePDF XP", True, , psFile
' Print the first worksheet counting from the left
' (Comment the following if you want to print all worksheets in
' the opened workbook)
'.Worksheets(1).PrintOut , , , , "FreePDF XP", True, , psFile
' Close the workbook
.Workbooks(Workbookname & ".xls").Close False
' Quit Excel
.Quit
End With
' Release Excel Object
Set objExcel = Nothing
Dim objFreePDF, FreePDF, objShell, PDFFile, Parameter
' Create Shell object
Set objShell = WScript.CreateObject("WScript.Shell")
PDFFile = RptDir & "\" & Workbookname & ".pdf"
' Define the "freepdf.exe" in Full Path format
FreePDF = objShell.ExpandEnvironmentStrings("%ProgramFiles%") & _
"\FreePDF_XP\freepdf.exe"
'Define the parameter needed for outputing "pdf" files
Parameter = " /3 delps,end ""High Quality"" " & """" & PDFFile & _
""" """ & psFile & """"
If objFSO.FileExists(FreePDF) Then
' Run "freepdf.exe" with parameter and get the WshScriptExec
' object
Set objFreePDF = objShell.Exec(FreePDF & Parameter)
Wscript.Stdout.Write "Please wait "
' Check whether "freepdf.exe" ends for every 0.5 second
Do While objFreePDF.Status = 0
WScript.Sleep 500
Wscript.Stdout.Write "."
Loop
WScript.Echo vbCrLf & "Convertion finished." & vbCrLf
Else
' Prompt to user to install "FreePDF XP" before running this
' script
MsgBox _
"Please install ""FreePDF XP"" before running this script.", _
vbExclamation, "Error"
End If
' Release objects
Set objShell = Nothing: Set objFreePDF = Nothing
End Sub
'**********************************************************************
'*
'* Function: IsHostCscript()
'* Purpose: Check if "cscript.exe" is to run this script
'* Output: Returns true if the script host is "cscript.exe"
'*
'**********************************************************************
Private Function IsHostCscript()
On Error Resume Next
Dim strFullName, strCommand, i, j
Dim bReturn: bReturn = False
strFullName = WScript.FullName
i = InStr(1, strFullName, ".exe", 1)
If i <> 0 Then
j = InStrRev(strFullName, "\", i, 1)
If j <> 0 Then
strCommand = Mid(strFullName, j + 1, i - j - 1)
If LCase(strCommand) = "cscript" Then bReturn = True
End If
End If
If Err <> 0 Then _
WScript.Echo "Error 0x" & Hex(Err.Number) & " occurred. " &
Err.Description _
& ". " & vbCrLf & "The scripting host could not be determined."
IsHostCscript = bReturn
End Function
----------------------------------8<--------------------------------- Tag: mail-enabled a global security group Tag: 179286
Authentication Scheme
Hi,
I'd like to know on the fly what the current authentication schema is. It
could be one of the followings: NTLM, BASIC, DIGEST, PASSPORT, NEGOTIATE.
Does anyone knows how do I retrieve the current authentication scheme in
vbscript?
Please advice, thanks!
-P Tag: mail-enabled a global security group Tag: 179281
Is there a way to mail-enabled a global security group in a vb script? We
are running windows 2003 for our AD and Exchange 2003 SP1.