I am writing a simple script to get more familiar with powershell.
This script reads input parameters into a hash
$states = @($args)
$states
write-host Color is $states.color
On the command-line, I set the following values$shape = 'circle'; $color = 'pink'; $size = 'large'I then invoke the...
I am writing powershell script to interface with an external software program our company is using
The script needs to take in value of the input parameter and do something.
But the problem is, this external software pushes many input parameters with the names
•sender-email
•sender-ip...
Hello,
I am scripting in powershell to read from table, and then update table.
It works very well - except when another user or program is trying to read or update the table at the same time.
This is unavoidable, so I would like to know how to prevent transaction deadlocks.
Here is code to...
I have powershell code,
$file = Import-CSV C:\PS\IP_list.csv
Write-Output $file
And I have output
http://www.mediafire.com/i/?oldomqsvm9w67wl
I am unable to figure out how to access 1st row, 2nd column, or 2nd row, 4th column.
Help!
I am testing a vbscript to turn off a service that requires a password:
'Stop smc.exe service
objWMISvc.Create(strPath & "\smc.exe -stop our_secret_password")
This works really well, but here's the problem. On the test computer where I am stopping smc.exe, I see a pop-up that prompts the...
When I attempt to debug a VBScript in MS Windows Server 2008 via command-line
cscript //x script.vbs
The debugger never launches. Is there another utility to download.
On this particular Windows Server 2008, under Services, I do see that Windows Management Instrumentation has started.
I am trying to build a script that eventually deletes tmp, err, files from remote computers.
There are certain directories that Disk Cleanup just cannot touch, especially if these folders are from other programs installed on Windows.
Right now, I'm trying this on my own computer, and it is...
I modified the script from
http://www.tek-tips.com/viewthread.cfm?qid=1635255
Option Explicit
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim strDir, objDir
strDir = "d:\"
Set objDir = FSO.GetFolder(strDir)
PrintFiles(objDir)
Sub PrintFiles(pCurrentDir)
Dim aItem...
I'm creating a script that involves stopping and starting a service.
How do I handle a situation where service fails to start on time, say, after 2 minutes?
Code to start service
do
Set colProcesses = GetObject("winmgmts:\\" & strComputer & "\root\cimv2"). _
ExecQuery("Select * from...
I am creating a script such that it deletes a registry value.
First, I make sure I can ping it.
Then, I make sure I can connect to registry value.
Out of 20 computers, 9 of them are pingable, and two of them can connect to registry value.
However, out of curiosity, I rdp'd into one of the...
I am looking for the best way to create script such that
1. It cleans disk space of remote computer
2. Does this silently
I found script here
http://www.visualbasicscript.com/How-to-schedule-a-Disk-Cleanup-and-defrag-in-XP-via-VBScript-m66923.aspx
but when I tried it on my computer, a prompt...
I am writing a script to check the existence of a folder.
After declaring Option Explicit and using the command-line
cscript //x script.vbs
I still cannot figure out why the script says that a folder exists even though I can see it does not
This is the snippit of code
' Can we...
I've been running diagnostic script on numerous computers. On the command line icon, I right click and select "Run As"
However later on when I use the Sysinternals command
psloggedon //[IP address]
It displays that I am logged on locally.
How do I avoid this? Or is there a way to...
I've been searching how to ping an IP address to extract the computer name.
For instance, if I execute
ping -n 2 -a [IP Address]
I get the following output
Pinging HostName.suffix.suffix.suffix [IP Address] with 32 bytes of data:
Reply from IP Address: bytes=32 time=7ms TTL=121
Reply from...
I modified code such that, it will bypass IP addresses it cannot make WMI connection to.
However, there is one IP address which causes the program to throw an error
Whether it is several IP addresses, or that one particular IP address in the list, it causes the error on line 65...
I've spent a week trying to troubleshoot my code.
At first, I thought the computer was pointed to the wrong DNS server, and that's why I'm getting inconsistent output.
But, when I try each IP address individually, I either get the accurate result, or no result at all (because computer cannot...
I am writing a script such that, it will display computer name based on IP address
Set objWMISvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", ,48 )
For Each objItem in...
I am trying to split the string:
D:\PROGRA~1\COMMON~1\SYMANT~1\VIRUSD~1\20111208.001
I wrote the following code
strKeyPath = "SOFTWARE\Symantec\SharedDefs"
strValueName = "DEFWATCH_10"
oReg.GetStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strVirus = strValue...
I am trying to create a script that deletes a file that is generated in the process of a service is shutting down. Once the service has shut down, the file disappears.
That means, the script must
1. Detect the presence of a file
2. Then it can delete it
What WMI tools do I use? Are there other...
I have created the following script to troubleshoot issue on our network:
Option Explicit
Dim objInputFSO, objOutputFSO, objFile
Dim strInputFile, strData, arrLines, strLine
Dim objWMISvc, colItems, objItem, strComputerDomain, strMember
Dim strComputer, strKeyPath, strValueName, oReg...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.