Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Execute vbscript using cscript.exe on remote machine using Powershell

Reply
 
Old 07-27-2009   #1 (permalink)
proxb


 
 

Execute vbscript using cscript.exe on remote machine using Powershell

Hi everyone.
I am pretty much out of ideas on how to remotely execute a vbscript
that I placed on all of our servers using powershell. Here is the
code I am using:

Function VerifyScript
{
$destination = "\\$server\c$\"
$script = "\\$server\C$\update.vbs"
$verify = test-path $script
If ($verify -match "False")
{
xcopy /C update.vbs $destination | out-null
Write-output "File copied to $server" >> "log.txt"
}


}

Function InstallUpdates
{
$wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
$wmiprocess.create("cscript.exe C:\update.vbs") | out-null
}


$servers = Get-Content "host.txt"
ForEach ($server in $servers)
{

VerifyScript
InstallUpdates
}

The script actually runs and does create the cscript process on the
remote machine, but disappears probably within 4 or 5 seconds and
nothing happens.
The update.vbs script is used to install all of the patches downloaded
from our WSUS server and then creates a log file on another folder
share.
It appears that while the script runs the cscript.exe command, it
ignores C:\update.vbs.

I've spent a week trying to research a good way to get this
accomplished but have had less than stellar luck finding anything
good. If anyone has any suggestions on what I could try, I would
greatly appreciate it.

My System SpecsSystem Spec
Old 07-27-2009   #2 (permalink)
Joel Bennett


 
 

Re: Execute vbscript using cscript.exe on remote machine using Powershell

Are you sure this is copying the file to the spot you intended? The
"C$\" part of your path is almost certainly getting screwed up by being
parsed as a variable, I would think.

Try:
$destination = "\\$server\c`$\"
$script = "\\$server\C`$\update.vbs"

--
Joel


proxb wrote:
Quote:

> Hi everyone.
> I am pretty much out of ideas on how to remotely execute a vbscript
> that I placed on all of our servers using powershell. Here is the
> code I am using:
>
> Function VerifyScript
> {
> $destination = "\\$server\c$\"
> $script = "\\$server\C$\update.vbs"
> $verify = test-path $script
> If ($verify -match "False")
> {
> xcopy /C update.vbs $destination | out-null
> Write-output "File copied to $server">> "log.txt"
> }
>
>
> }
>
> Function InstallUpdates
> {
> $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> }
>
>
> $servers = Get-Content "host.txt"
> ForEach ($server in $servers)
> {
>
> VerifyScript
> InstallUpdates
> }
>
> The script actually runs and does create the cscript process on the
> remote machine, but disappears probably within 4 or 5 seconds and
> nothing happens.
> The update.vbs script is used to install all of the patches downloaded
> from our WSUS server and then creates a log file on another folder
> share.
> It appears that while the script runs the cscript.exe command, it
> ignores C:\update.vbs.
>
> I've spent a week trying to research a good way to get this
> accomplished but have had less than stellar luck finding anything
> good. If anyone has any suggestions on what I could try, I would
> greatly appreciate it.
My System SpecsSystem Spec
Old 07-28-2009   #3 (permalink)
Vadims Podans [MVP]


 
 

Re: Execute vbscript using cscript.exe on remote machine using Powershell

here all is Ok.
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"Joel Bennett" <Jaykul@xxxxxx> rakstija zinojuma
"news:eKFFpkxDKHA.5092@xxxxxx"...
Quote:

> Are you sure this is copying the file to the spot you intended? The "C$\"
> part of your path is almost certainly getting screwed up by being parsed
> as a variable, I would think.
>
> Try:
> $destination = "\\$server\c`$\"
> $script = "\\$server\C`$\update.vbs"
>
> --
> Joel
>
>
> proxb wrote:
Quote:

>> Hi everyone.
>> I am pretty much out of ideas on how to remotely execute a vbscript
>> that I placed on all of our servers using powershell. Here is the
>> code I am using:
>>
>> Function VerifyScript
>> {
>> $destination = "\\$server\c$\"
>> $script = "\\$server\C$\update.vbs"
>> $verify = test-path $script
>> If ($verify -match "False")
>> {
>> xcopy /C update.vbs $destination | out-null
>> Write-output "File copied to $server">> "log.txt"
>> }
>>
>>
>> }
>>
>> Function InstallUpdates
>> {
>> $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
>> $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
>> }
>>
>>
>> $servers = Get-Content "host.txt"
>> ForEach ($server in $servers)
>> {
>>
>> VerifyScript
>> InstallUpdates
>> }
>>
>> The script actually runs and does create the cscript process on the
>> remote machine, but disappears probably within 4 or 5 seconds and
>> nothing happens.
>> The update.vbs script is used to install all of the patches downloaded
>> from our WSUS server and then creates a log file on another folder
>> share.
>> It appears that while the script runs the cscript.exe command, it
>> ignores C:\update.vbs.
>>
>> I've spent a week trying to research a good way to get this
>> accomplished but have had less than stellar luck finding anything
>> good. If anyone has any suggestions on what I could try, I would
>> greatly appreciate it.
My System SpecsSystem Spec
Old 07-28-2009   #4 (permalink)
Vadims Podans [MVP]


 
 

Re: Execute vbscript using cscript.exe on remote machine using Powershell


Function VerifyScript {
$destination = "\\$server\c$"
$script = Join-Path $destination "update.vbs"
if (test-path $script) {copyupdate.vbs $destination -ea 0
"File copied to $server" >> "log.txt"
}

Function InstallUpdates {
[void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
C:\update.vbs")
}
Get-Content hosts.txt | %{VerifyScript; InstallUpdates}

in fact you can place all in one function:

filter Install-Update {
$server = $_
$destination = "\\$server\c$"
$script = Join-Path $destination "update.vbs"
if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
"File copied to $server" >> "log.txt"
}
[void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
C:\update.vbs")
}

and usage:
Get-Content hosts.txt | Install-Update

so, the error may be in your VBS file.
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"proxb" <boeprox@xxxxxx> rakstija zinojuma
"news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"...
Quote:

> Hi everyone.
> I am pretty much out of ideas on how to remotely execute a vbscript
> that I placed on all of our servers using powershell. Here is the
> code I am using:
>
> Function VerifyScript
> {
> $destination = "\\$server\c$\"
> $script = "\\$server\C$\update.vbs"
> $verify = test-path $script
> If ($verify -match "False")
> {
> xcopy /C update.vbs $destination | out-null
> Write-output "File copied to $server" >> "log.txt"
> }
>
>
> }
>
> Function InstallUpdates
> {
> $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> }
>
>
> $servers = Get-Content "host.txt"
> ForEach ($server in $servers)
> {
>
> VerifyScript
> InstallUpdates
> }
>
> The script actually runs and does create the cscript process on the
> remote machine, but disappears probably within 4 or 5 seconds and
> nothing happens.
> The update.vbs script is used to install all of the patches downloaded
> from our WSUS server and then creates a log file on another folder
> share.
> It appears that while the script runs the cscript.exe command, it
> ignores C:\update.vbs.
>
> I've spent a week trying to research a good way to get this
> accomplished but have had less than stellar luck finding anything
> good. If anyone has any suggestions on what I could try, I would
> greatly appreciate it.
My System SpecsSystem Spec
Old 07-28-2009   #5 (permalink)
Boe


 
 

Re: Execute vbscript using cscript.exe on remote machine usingPowershell

On Jul 28, 4:18*am, "Vadims Podans [MVP]" <vpodans> wrote:
Quote:

> Function VerifyScript {
> $destination = "\\$server\c$"
> $script = Join-Path $destination "update.vbs"
> if (test-path $script) {copyupdate.vbs $destination -ea 0
> "File copied to $server" >> "log.txt"
>
> }
>
> Function InstallUpdates {
> [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> C:\update.vbs")}
>
> Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
>
> in fact you can place all in one function:
>
> filter Install-Update {
> $server = $_
> $destination = "\\$server\c$"
> $script = Join-Path $destination "update.vbs"
> if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> "File copied to $server" >> "log.txt"}
>
> [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> C:\update.vbs")
>
> }
>
> and usage:
> Get-Content hosts.txt | Install-Update
>
> so, the error may be in your VBS file.
> --
> WBR, Vadims Podans
> MVP: PowerShell
> PowerShell blog -www.sysadmins.lv
>
> "proxb" <boep...@xxxxxx> rakstija zinojuma
> "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
>
>
>
Quote:

> > Hi everyone.
> > I am pretty much out of ideas on how to remotely execute a vbscript
> > that I placed on all of our servers using powershell. *Here is the
> > code I am using:
>
Quote:

> > Function VerifyScript
> > {
> > $destination = "\\$server\c$\"
> > $script = "\\$server\C$\update.vbs"
> > $verify = test-path $script
> > If ($verify -match "False")
> > {
> > xcopy /C update.vbs $destination | out-null
> > Write-output "File copied to $server" >> "log.txt"
> > }
>
Quote:

> > }
>
Quote:

> > Function InstallUpdates
> > {
> > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > }
>
Quote:

> > $servers = Get-Content "host.txt"
> > ForEach ($server in $servers)
> > {
>
Quote:

> > VerifyScript
> > InstallUpdates
> > }
>
Quote:

> > The script actually runs and does create the cscript process on the
> > remote machine, but disappears probably within 4 or 5 seconds and
> > nothing happens.
> > The update.vbs script is used to install all of the patches downloaded
> > from our WSUS server and then creates a log file on another folder
> > share.
> > It appears that while the script runs the cscript.exe command, it
> > ignores C:\update.vbs.
>
Quote:

> > I've spent a week trying to research a good way to get this
> > accomplished but have had less than stellar luck finding anything
> > good. *If anyone has any suggestions on what I could try, I would
> > greatly appreciate it.- Hide quoted text -
>
> - Show quoted text -
Thanks, I will give this a shot and see what happens. I still have a
lot to learn about powershell and appreciate all of the support in
helping to get this script off the ground and running.
I was able to verify that the vbscript works by running it on a couple
servers and had no issues with it prior to writing the powershell
script to run it remotely.
Just to be sure that it was something in the powershell script and not
the vbscript, i create a quick vbscript that would just create a text
file with a one line sentence on the c:\ of a server. I ran it locally
and it worked with no issues, however, once I ran it from the script,
it would kick off the cscript process but quit shortly after without
leaving a file.

I will use your recommendations for the script and will report back
the status.

Thanks again.
My System SpecsSystem Spec
Old 07-28-2009   #6 (permalink)
Bob Landau


 
 

Re: Execute vbscript using cscript.exe on remote machine using Pow

You are on the right direction by simplifying the problem.

Don't write to c:\ only Admin's can write the file to c:\temp.

I also suspect you could issolate 99% or your problems more easily by
running the script under the scheduler on the local machine. Within your
script make certain you're not relying on either a current user's environment
or permissions. Lastly SMB will not work if this script is running under the
localsystem account and is not likely to work under either local service or
network accounts



"Boe" wrote:
Quote:

> On Jul 28, 4:18 am, "Vadims Podans [MVP]" <vpodans> wrote:
Quote:

> > Function VerifyScript {
> > $destination = "\\$server\c$"
> > $script = Join-Path $destination "update.vbs"
> > if (test-path $script) {copyupdate.vbs $destination -ea 0
> > "File copied to $server" >> "log.txt"
> >
> > }
> >
> > Function InstallUpdates {
> > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > C:\update.vbs")}
> >
> > Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
> >
> > in fact you can place all in one function:
> >
> > filter Install-Update {
> > $server = $_
> > $destination = "\\$server\c$"
> > $script = Join-Path $destination "update.vbs"
> > if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> > "File copied to $server" >> "log.txt"}
> >
> > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > C:\update.vbs")
> >
> > }
> >
> > and usage:
> > Get-Content hosts.txt | Install-Update
> >
> > so, the error may be in your VBS file.
> > --
> > WBR, Vadims Podans
> > MVP: PowerShell
> > PowerShell blog -www.sysadmins.lv
> >
> > "proxb" <boep...@xxxxxx> rakstija zinojuma
> > "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
> >
> >
> >
Quote:

> > > Hi everyone.
> > > I am pretty much out of ideas on how to remotely execute a vbscript
> > > that I placed on all of our servers using powershell. Here is the
> > > code I am using:
> >
Quote:

> > > Function VerifyScript
> > > {
> > > $destination = "\\$server\c$\"
> > > $script = "\\$server\C$\update.vbs"
> > > $verify = test-path $script
> > > If ($verify -match "False")
> > > {
> > > xcopy /C update.vbs $destination | out-null
> > > Write-output "File copied to $server" >> "log.txt"
> > > }
> >
Quote:

> > > }
> >
Quote:

> > > Function InstallUpdates
> > > {
> > > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > > }
> >
Quote:

> > > $servers = Get-Content "host.txt"
> > > ForEach ($server in $servers)
> > > {
> >
Quote:

> > > VerifyScript
> > > InstallUpdates
> > > }
> >
Quote:

> > > The script actually runs and does create the cscript process on the
> > > remote machine, but disappears probably within 4 or 5 seconds and
> > > nothing happens.
> > > The update.vbs script is used to install all of the patches downloaded
> > > from our WSUS server and then creates a log file on another folder
> > > share.
> > > It appears that while the script runs the cscript.exe command, it
> > > ignores C:\update.vbs.
> >
Quote:

> > > I've spent a week trying to research a good way to get this
> > > accomplished but have had less than stellar luck finding anything
> > > good. If anyone has any suggestions on what I could try, I would
> > > greatly appreciate it.- Hide quoted text -
> >
> > - Show quoted text -
>
> Thanks, I will give this a shot and see what happens. I still have a
> lot to learn about powershell and appreciate all of the support in
> helping to get this script off the ground and running.
> I was able to verify that the vbscript works by running it on a couple
> servers and had no issues with it prior to writing the powershell
> script to run it remotely.
> Just to be sure that it was something in the powershell script and not
> the vbscript, i create a quick vbscript that would just create a text
> file with a one line sentence on the c:\ of a server. I ran it locally
> and it worked with no issues, however, once I ran it from the script,
> it would kick off the cscript process but quit shortly after without
> leaving a file.
>
> I will use your recommendations for the script and will report back
> the status.
>
> Thanks again.
>
My System SpecsSystem Spec
Old 07-28-2009   #7 (permalink)
Boe


 
 

Re: Execute vbscript using cscript.exe on remote machine using Pow

On Jul 28, 10:51*am, Bob Landau <BobLan...@xxxxxx>
wrote:
Quote:

> You are on the right direction by simplifying the problem.
>
> Don't write to c:\ *only Admin's can write the file to c:\temp.
>
> I also suspect you could issolate 99% or your problems more easily by
> running the script under the scheduler on the local machine. Within your
> script make certain you're not relying on either a current user's environment
> or permissions. Lastly SMB will not work if this script is running under the
> localsystem account and is not likely to work under either local service or
> network accounts
>
>
>
> "Boe" wrote:
Quote:

> > On Jul 28, 4:18 am, "Vadims Podans [MVP]" <vpodans> wrote:
Quote:

> > > Function VerifyScript {
> > > $destination = "\\$server\c$"
> > > $script = Join-Path $destination "update.vbs"
> > > if (test-path $script) {copyupdate.vbs $destination -ea 0
> > > "File copied to $server" >> "log.txt"
>
Quote:
Quote:

> > > }
>
Quote:
Quote:

> > > Function InstallUpdates {
> > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > C:\update.vbs")}
>
Quote:
Quote:

> > > Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
>
Quote:
Quote:

> > > in fact you can place all in one function:
>
Quote:
Quote:

> > > filter Install-Update {
> > > $server = $_
> > > $destination = "\\$server\c$"
> > > $script = Join-Path $destination "update.vbs"
> > > if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> > > "File copied to $server" >> "log.txt"}
>
Quote:
Quote:

> > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > C:\update.vbs")
>
Quote:
Quote:

> > > }
>
Quote:
Quote:

> > > and usage:
> > > Get-Content hosts.txt | Install-Update
>
Quote:
Quote:

> > > so, the error may be in your VBS file.
> > > --
> > > WBR, Vadims Podans
> > > MVP: PowerShell
> > > PowerShell blog -www.sysadmins.lv
>
Quote:
Quote:

> > > "proxb" <boep...@xxxxxx> rakstija zinojuma
> > > "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
>
Quote:
Quote:

> > > > Hi everyone.
> > > > I am pretty much out of ideas on how to remotely execute a vbscript
> > > > that I placed on all of our servers using powershell. *Here is the
> > > > code I am using:
>
Quote:
Quote:

> > > > Function VerifyScript
> > > > {
> > > > $destination = "\\$server\c$\"
> > > > $script = "\\$server\C$\update.vbs"
> > > > $verify = test-path $script
> > > > If ($verify -match "False")
> > > > {
> > > > xcopy /C update.vbs $destination | out-null
> > > > Write-output "File copied to $server" >> "log.txt"
> > > > }
>
Quote:
Quote:

> > > > }
>
Quote:
Quote:

> > > > Function InstallUpdates
> > > > {
> > > > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > > > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > > > }
>
Quote:
Quote:

> > > > $servers = Get-Content "host.txt"
> > > > ForEach ($server in $servers)
> > > > {
>
Quote:
Quote:

> > > > VerifyScript
> > > > InstallUpdates
> > > > }
>
Quote:
Quote:

> > > > The script actually runs and does create the cscript process on the
> > > > remote machine, but disappears probably within 4 or 5 seconds and
> > > > nothing happens.
> > > > The update.vbs script is used to install all of the patches downloaded
> > > > from our WSUS server and then creates a log file on another folder
> > > > share.
> > > > It appears that while the script runs the cscript.exe command, it
> > > > ignores C:\update.vbs.
>
Quote:
Quote:

> > > > I've spent a week trying to research a good way to get this
> > > > accomplished but have had less than stellar luck finding anything
> > > > good. *If anyone has any suggestions on what I could try, I would
> > > > greatly appreciate it.- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -
>
Quote:

> > Thanks, I will give this a shot and see what happens. *I still have a
> > lot to learn about powershell and appreciate all of the support in
> > helping to get this script off the ground and running.
> > I was able to verify that the vbscript works by running it on a couple
> > servers and had no issues with it prior to writing the powershell
> > script to run it remotely.
> > Just to be sure that it was something in the powershell script and not
> > the vbscript, i create a quick vbscript that would just create a text
> > file with a one line sentence on the c:\ of a server. I ran it locally
> > and it worked with no issues, however, once I ran it from the script,
> > it would kick off the cscript process but quit shortly after without
> > leaving a file.
>
Quote:

> > I will use your recommendations for the script and will report back
> > the status.
>
Quote:

> > Thanks again.- Hide quoted text -
>
> - Show quoted text -
Thanks Bob,
I had sent another message on here prior to your reply, but for some
reason, it failed to post. I am going to re-post the message and then
add my reply to you in it...

'No luck on this. Just to test it, I used my test.vbs script located
on the C:\ which just creates a text file with a one line sentence:

set ofso = CreateObject("Scripting.FileSystemObject")
set text = ofso.createtextfile("TEST.txt")
text.writeline "This is a test"

I was able to run it locally on the server using both wscript and
cscript. However when I try to run this line of code in powershell:

$server = "servername"
[void]([wmiclass]"\\$server\root\cimv2:win32_process").Create
("cscript.exe C:\test.vbs")

The only thing that happens is the command prompt windows opens for a
second and closes along with the cscript.exe process appearing in Task
Manager for a second or two and then disappearing.
It would appear that powershell doesn't want to read anything after
the cscript.exe portion of the script for some reason. '

Bob, this script is running under a Domain Administrator account that
has Administrator rights on all of the servers that this script will
be eventually hitting and eventually this powershell script will be a
scheduled task running from one server under a service account with
Domain Administrator rights. Are you talking about running the vbs
script as a scheduled task on the local server as opposed to running
the powershell script to kick off the vbscript? If so, I am trying to
avoid that as we have a lot of servers and this would be no better
than what we do already and our schedule for patching fluctuates to
greatly to set a schedule to run the install script.

Let me know if this makes sense and if not, I will clarify better as
sometimes when I write, I tend to say it for myself to understand
versus everyone else understanding...lol.

Also, I did some more searching and found a link that talks about
running the same command in vbscript:
http://blogs.technet.com/heyscriptin...nk-spaces.aspx
I am going to give this a try in vbscript form first and see if it
works, and if so, maybe see a way to convert this over to powershell,
if possible. Or if anything, call it from powershell with each server
to run against.

Thanks again.

My System SpecsSystem Spec
Old 07-28-2009   #8 (permalink)
Boe


 
 

Re: Execute vbscript using cscript.exe on remote machine using Pow

On Jul 28, 12:39*pm, Boe <boep...@xxxxxx> wrote:
Quote:

> On Jul 28, 10:51*am, Bob Landau <BobLan...@xxxxxx>
> wrote:
>
>
>
>
>
Quote:

> > You are on the right direction by simplifying the problem.
>
Quote:

> > Don't write to c:\ *only Admin's can write the file to c:\temp.
>
Quote:

> > I also suspect you could issolate 99% or your problems more easily by
> > running the script under the scheduler on the local machine. Within your
> > script make certain you're not relying on either a current user's environment
> > or permissions. Lastly SMB will not work if this script is running under the
> > localsystem account and is not likely to work under either local service or
> > network accounts
>
Quote:

> > "Boe" wrote:
Quote:

> > > On Jul 28, 4:18 am, "Vadims Podans [MVP]" <vpodans> wrote:
> > > > Function VerifyScript {
> > > > $destination = "\\$server\c$"
> > > > $script = Join-Path $destination "update.vbs"
> > > > if (test-path $script) {copyupdate.vbs $destination -ea 0
> > > > "File copied to $server" >> "log.txt"
>
Quote:
Quote:

> > > > }
>
Quote:
Quote:

> > > > Function InstallUpdates {
> > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > C:\update.vbs")}
>
Quote:
Quote:

> > > > Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
>
Quote:
Quote:

> > > > in fact you can place all in one function:
>
Quote:
Quote:

> > > > filter Install-Update {
> > > > $server = $_
> > > > $destination = "\\$server\c$"
> > > > $script = Join-Path $destination "update.vbs"
> > > > if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> > > > "File copied to $server" >> "log.txt"}
>
Quote:
Quote:

> > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > C:\update.vbs")
>
Quote:
Quote:

> > > > }
>
Quote:
Quote:

> > > > and usage:
> > > > Get-Content hosts.txt | Install-Update
>
Quote:
Quote:

> > > > so, the error may be in your VBS file.
> > > > --
> > > > WBR, Vadims Podans
> > > > MVP: PowerShell
> > > > PowerShell blog -www.sysadmins.lv
>
Quote:
Quote:

> > > > "proxb" <boep...@xxxxxx> rakstija zinojuma
> > > > "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
>
Quote:
Quote:

> > > > > Hi everyone.
> > > > > I am pretty much out of ideas on how to remotely execute a vbscript
> > > > > that I placed on all of our servers using powershell. *Here is the
> > > > > code I am using:
>
Quote:
Quote:

> > > > > Function VerifyScript
> > > > > {
> > > > > $destination = "\\$server\c$\"
> > > > > $script = "\\$server\C$\update.vbs"
> > > > > $verify = test-path $script
> > > > > If ($verify -match "False")
> > > > > {
> > > > > xcopy /C update.vbs $destination | out-null
> > > > > Write-output "File copied to $server" >> "log.txt"
> > > > > }
>
Quote:
Quote:

> > > > > }
>
Quote:
Quote:

> > > > > Function InstallUpdates
> > > > > {
> > > > > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > > > > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > > > > }
>
Quote:
Quote:

> > > > > $servers = Get-Content "host.txt"
> > > > > ForEach ($server in $servers)
> > > > > {
>
Quote:
Quote:

> > > > > VerifyScript
> > > > > InstallUpdates
> > > > > }
>
Quote:
Quote:

> > > > > The script actually runs and does create the cscript process on the
> > > > > remote machine, but disappears probably within 4 or 5 seconds and
> > > > > nothing happens.
> > > > > The update.vbs script is used to install all of the patches downloaded
> > > > > from our WSUS server and then creates a log file on another folder
> > > > > share.
> > > > > It appears that while the script runs the cscript.exe command, it
> > > > > ignores C:\update.vbs.
>
Quote:
Quote:

> > > > > I've spent a week trying to research a good way to get this
> > > > > accomplished but have had less than stellar luck finding anything
> > > > > good. *If anyone has any suggestions on what I could try, I would
> > > > > greatly appreciate it.- Hide quoted text -
>
Quote:
Quote:

> > > > - Show quoted text -
>
Quote:
Quote:

> > > Thanks, I will give this a shot and see what happens. *I still havea
> > > lot to learn about powershell and appreciate all of the support in
> > > helping to get this script off the ground and running.
> > > I was able to verify that the vbscript works by running it on a couple
> > > servers and had no issues with it prior to writing the powershell
> > > script to run it remotely.
> > > Just to be sure that it was something in the powershell script and not
> > > the vbscript, i create a quick vbscript that would just create a text
> > > file with a one line sentence on the c:\ of a server. I ran it locally
> > > and it worked with no issues, however, once I ran it from the script,
> > > it would kick off the cscript process but quit shortly after without
> > > leaving a file.
>
Quote:
Quote:

> > > I will use your recommendations for the script and will report back
> > > the status.
>
Quote:
Quote:

> > > Thanks again.- Hide quoted text -
>
Quote:

> > - Show quoted text -
>
> Thanks Bob,
> I had sent another message on here prior to your reply, but for some
> reason, it failed to post. *I am going to re-post the message and then
> add my reply to you in it...
>
> 'No luck on this. *Just to test it, I used my test.vbs script located
> on the C:\ which just creates a text file with a one line sentence:
>
> set ofso = CreateObject("Scripting.FileSystemObject")
> set text = ofso.createtextfile("TEST.txt")
> text.writeline "This is a test"
>
> I was able to run it locally on the server using both wscript and
> cscript. *However when I try to run this line of code in powershell:
>
> $server = "servername"
> [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create
> ("cscript.exe C:\test.vbs")
>
> The only thing that happens is the command prompt windows opens for a
> second and closes along with the cscript.exe process appearing in Task
> Manager for a second or two and then disappearing.
> It would appear that powershell doesn't want to read anything after
> the cscript.exe portion of the script for some reason. '
>
> Bob, *this script is running under a Domain Administrator account that
> has Administrator rights on all of the servers that this script will
> be eventually hitting and eventually this powershell script will be a
> scheduled task running from one server under a service account with
> Domain Administrator rights. *Are you talking about running the vbs
> script as a scheduled task on the local server as opposed to running
> the powershell script to kick off the vbscript? If so, I am trying to
> avoid that as we have a lot of servers and this would be no better
> than what we do already and our schedule for patching fluctuates to
> greatly to set a schedule to run the install script.
>
> Let me know if this makes sense and if not, I will clarify better as
> sometimes when I write, I tend to say it for myself to understand
> versus everyone else understanding...lol.
>
> Also, I did some more searching and found a link that talks about
> running the same command in vbscript:http://blogs.technet.com/heyscriptin...0/29/hey-scrip...
> I am going to give this a try in vbscript form first and see if it
> works, and if so, maybe see a way to convert this over to powershell,
> if possible. Or if anything, call it from powershell with each server
> to run against.
>
> Thanks again.- Hide quoted text -
>
> - Show quoted text -
Ok, I was successful in running the script I found to remotely run the
vbscript on the remote machine to create a text file. Here is the
script:

strComputer = "servername"
Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2:Win32_Process")
strCommand = "cscript " & Chr(34) & "C:\test.vbs" & Chr(34)
objProcess.Create strCommand,null,null,intProcessID

Now I am going to try to convert the 3rd line to powershell and give
it a go. If not, then I will call this script in powershell and try
to run it that way.
My System SpecsSystem Spec
Old 07-29-2009   #9 (permalink)
Bob Landau


 
 

Re: Execute vbscript using cscript.exe on remote machine using Pow

I think now in hindsight the problem was likely on how WMI was parsing the
parameter "cscript.exe c:\update.vbs"

If I were you I'd hold off in changing a working script just to convert it
to a Powershell script. While I don't think the Powershell group achieved
their goal of working seemlessly with .BAT,VBS, native commands they have
done a good job.

When v2 ships remoting and jobs will be available to you which will make
executing remote calls easier. At that time you "may" find that by converting
to a Powershell script you can make you task easier.

In regards to the scheduler all I was trying to get at is this would have
independently verified that the script depended on

1) interactive desktop
2) current user environment Admin or not
3) current user permissions
4) interactive user. Processes launched via a service which I suspect WMI
must do at least in the remote case; will have troubles accessing anything
off box.

"Boe" wrote:
Quote:

> On Jul 28, 12:39 pm, Boe <boep...@xxxxxx> wrote:
Quote:

> > On Jul 28, 10:51 am, Bob Landau <BobLan...@xxxxxx>
> > wrote:
> >
> >
> >
> >
> >
Quote:

> > > You are on the right direction by simplifying the problem.
> >
Quote:

> > > Don't write to c:\ only Admin's can write the file to c:\temp.
> >
Quote:

> > > I also suspect you could issolate 99% or your problems more easily by
> > > running the script under the scheduler on the local machine. Within your
> > > script make certain you're not relying on either a current user's environment
> > > or permissions. Lastly SMB will not work if this script is running under the
> > > localsystem account and is not likely to work under either local service or
> > > network accounts
> >
Quote:

> > > "Boe" wrote:
> > > > On Jul 28, 4:18 am, "Vadims Podans [MVP]" <vpodans> wrote:
> > > > > Function VerifyScript {
> > > > > $destination = "\\$server\c$"
> > > > > $script = Join-Path $destination "update.vbs"
> > > > > if (test-path $script) {copyupdate.vbs $destination -ea 0
> > > > > "File copied to $server" >> "log.txt"
> >
Quote:

> > > > > }
> >
Quote:

> > > > > Function InstallUpdates {
> > > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > > C:\update.vbs")}
> >
Quote:

> > > > > Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
> >
Quote:

> > > > > in fact you can place all in one function:
> >
Quote:

> > > > > filter Install-Update {
> > > > > $server = $_
> > > > > $destination = "\\$server\c$"
> > > > > $script = Join-Path $destination "update.vbs"
> > > > > if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> > > > > "File copied to $server" >> "log.txt"}
> >
Quote:

> > > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > > C:\update.vbs")
> >
Quote:

> > > > > }
> >
Quote:

> > > > > and usage:
> > > > > Get-Content hosts.txt | Install-Update
> >
Quote:

> > > > > so, the error may be in your VBS file.
> > > > > --
> > > > > WBR, Vadims Podans
> > > > > MVP: PowerShell
> > > > > PowerShell blog -www.sysadmins.lv
> >
Quote:

> > > > > "proxb" <boep...@xxxxxx> rakstija zinojuma
> > > > > "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
> >
Quote:

> > > > > > Hi everyone.
> > > > > > I am pretty much out of ideas on how to remotely execute a vbscript
> > > > > > that I placed on all of our servers using powershell. Here is the
> > > > > > code I am using:
> >
Quote:

> > > > > > Function VerifyScript
> > > > > > {
> > > > > > $destination = "\\$server\c$\"
> > > > > > $script = "\\$server\C$\update.vbs"
> > > > > > $verify = test-path $script
> > > > > > If ($verify -match "False")
> > > > > > {
> > > > > > xcopy /C update.vbs $destination | out-null
> > > > > > Write-output "File copied to $server" >> "log.txt"
> > > > > > }
> >
Quote:

> > > > > > }
> >
Quote:

> > > > > > Function InstallUpdates
> > > > > > {
> > > > > > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > > > > > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > > > > > }
> >
Quote:

> > > > > > $servers = Get-Content "host.txt"
> > > > > > ForEach ($server in $servers)
> > > > > > {
> >
Quote:

> > > > > > VerifyScript
> > > > > > InstallUpdates
> > > > > > }
> >
Quote:

> > > > > > The script actually runs and does create the cscript process on the
> > > > > > remote machine, but disappears probably within 4 or 5 seconds and
> > > > > > nothing happens.
> > > > > > The update.vbs script is used to install all of the patches downloaded
> > > > > > from our WSUS server and then creates a log file on another folder
> > > > > > share.
> > > > > > It appears that while the script runs the cscript.exe command, it
> > > > > > ignores C:\update.vbs.
> >
Quote:

> > > > > > I've spent a week trying to research a good way to get this
> > > > > > accomplished but have had less than stellar luck finding anything
> > > > > > good. If anyone has any suggestions on what I could try, I would
> > > > > > greatly appreciate it.- Hide quoted text -
> >
Quote:

> > > > > - Show quoted text -
> >
Quote:

> > > > Thanks, I will give this a shot and see what happens. I still have a
> > > > lot to learn about powershell and appreciate all of the support in
> > > > helping to get this script off the ground and running.
> > > > I was able to verify that the vbscript works by running it on a couple
> > > > servers and had no issues with it prior to writing the powershell
> > > > script to run it remotely.
> > > > Just to be sure that it was something in the powershell script and not
> > > > the vbscript, i create a quick vbscript that would just create a text
> > > > file with a one line sentence on the c:\ of a server. I ran it locally
> > > > and it worked with no issues, however, once I ran it from the script,
> > > > it would kick off the cscript process but quit shortly after without
> > > > leaving a file.
> >
Quote:

> > > > I will use your recommendations for the script and will report back
> > > > the status.
> >
Quote:

> > > > Thanks again.- Hide quoted text -
> >
Quote:

> > > - Show quoted text -
> >
> > Thanks Bob,
> > I had sent another message on here prior to your reply, but for some
> > reason, it failed to post. I am going to re-post the message and then
> > add my reply to you in it...
> >
> > 'No luck on this. Just to test it, I used my test.vbs script located
> > on the C:\ which just creates a text file with a one line sentence:
> >
> > set ofso = CreateObject("Scripting.FileSystemObject")
> > set text = ofso.createtextfile("TEST.txt")
> > text.writeline "This is a test"
> >
> > I was able to run it locally on the server using both wscript and
> > cscript. However when I try to run this line of code in powershell:
> >
> > $server = "servername"
> > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create
> > ("cscript.exe C:\test.vbs")
> >
> > The only thing that happens is the command prompt windows opens for a
> > second and closes along with the cscript.exe process appearing in Task
> > Manager for a second or two and then disappearing.
> > It would appear that powershell doesn't want to read anything after
> > the cscript.exe portion of the script for some reason. '
> >
> > Bob, this script is running under a Domain Administrator account that
> > has Administrator rights on all of the servers that this script will
> > be eventually hitting and eventually this powershell script will be a
> > scheduled task running from one server under a service account with
> > Domain Administrator rights. Are you talking about running the vbs
> > script as a scheduled task on the local server as opposed to running
> > the powershell script to kick off the vbscript? If so, I am trying to
> > avoid that as we have a lot of servers and this would be no better
> > than what we do already and our schedule for patching fluctuates to
> > greatly to set a schedule to run the install script.
> >
> > Let me know if this makes sense and if not, I will clarify better as
> > sometimes when I write, I tend to say it for myself to understand
> > versus everyone else understanding...lol.
> >
> > Also, I did some more searching and found a link that talks about
> > running the same command in vbscript:http://blogs.technet.com/heyscriptin...0/29/hey-scrip...
> > I am going to give this a try in vbscript form first and see if it
> > works, and if so, maybe see a way to convert this over to powershell,
> > if possible. Or if anything, call it from powershell with each server
> > to run against.
> >
> > Thanks again.- Hide quoted text -
> >
> > - Show quoted text -
>
> Ok, I was successful in running the script I found to remotely run the
> vbscript on the remote machine to create a text file. Here is the
> script:
>
> strComputer = "servername"
> Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root
> \cimv2:Win32_Process")
> strCommand = "cscript " & Chr(34) & "C:\test.vbs" & Chr(34)
> objProcess.Create strCommand,null,null,intProcessID
>
> Now I am going to try to convert the 3rd line to powershell and give
> it a go. If not, then I will call this script in powershell and try
> to run it that way.
>
My System SpecsSystem Spec
Old 07-29-2009   #10 (permalink)
Boe


 
 

Re: Execute vbscript using cscript.exe on remote machine using Pow

I see what you are saying in regards to running as a scheduled task.
I will give that a shot because I am still running into an issue with
the vbscript actually installing the patches. I've set up logging on
the script and it writes to the log when creating the collection of
patches, but then just stops right at the point when it should be
installing the patches. I will set up some error checking too to maybe
see what is stopping it as well. For the sake of keeping powershell
with powershell, I will pose my vbscript question on the vbscript
group here and see what I get for responses since my powershell issue
is resolved at this point in time.

I will also take your advice on not converting the vbscript to
powershell, especially since I am very close to having this completed.

Thanks again everyone for helping me out with this.


On Jul 29, 12:53*pm, Bob Landau <BobLan...@xxxxxx>
wrote:
Quote:

> I think now in hindsight the problem was likely on how WMI was parsing the
> parameter "cscript.exe c:\update.vbs"
>
> If I were you I'd hold off in changing a working script just to convert it
> to a Powershell script. While I don't think the Powershell group achieved
> their goal of working seemlessly with .BAT,VBS, native commands they have
> done a good job.
>
> When v2 ships remoting and jobs will be available to you which will make
> executing remote calls easier. At that time you "may" find that by converting
> to a Powershell script you can make you task easier.
>
> In regards to the scheduler all I was trying to get at is this would have
> independently verified that the script depended on
>
> 1) interactive desktop
> 2) current user environment Admin or not
> 3) current user permissions
> 4) interactive user. Processes launched via a service which I suspect WMI
> must do at least in the remote case; will have troubles accessing anything
> off box.
>
>
>
> "Boe" wrote:
Quote:

> > On Jul 28, 12:39 pm, Boe <boep...@xxxxxx> wrote:
Quote:

> > > On Jul 28, 10:51 am, Bob Landau <BobLan...@xxxxxx>
> > > wrote:
>
Quote:
Quote:

> > > > You are on the right direction by simplifying the problem.
>
Quote:
Quote:

> > > > Don't write to c:\ *only Admin's can write the file to c:\temp.
>
Quote:
Quote:

> > > > I also suspect you could issolate 99% or your problems more easily by
> > > > running the script under the scheduler on the local machine. Withinyour
> > > > script make certain you're not relying on either a current user's environment
> > > > or permissions. Lastly SMB will not work if this script is running under the
> > > > localsystem account and is not likely to work under either local service or
> > > > network accounts
>
Quote:
Quote:

> > > > "Boe" wrote:
> > > > > On Jul 28, 4:18 am, "Vadims Podans [MVP]" <vpodans> wrote:
> > > > > > Function VerifyScript {
> > > > > > $destination = "\\$server\c$"
> > > > > > $script = Join-Path $destination "update.vbs"
> > > > > > if (test-path $script) {copyupdate.vbs $destination -ea 0
> > > > > > "File copied to $server" >> "log.txt"
>
Quote:
Quote:

> > > > > > }
>
Quote:
Quote:

> > > > > > Function InstallUpdates {
> > > > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > > > C:\update.vbs")}
>
Quote:
Quote:

> > > > > > Get-Content hosts.txt | %{VerifyScript; InstallUpdates}
>
Quote:
Quote:

> > > > > > in fact you can place all in one function:
>
Quote:
Quote:

> > > > > > filter Install-Update {
> > > > > > $server = $_
> > > > > > $destination = "\\$server\c$"
> > > > > > $script = Join-Path $destination "update.vbs"
> > > > > > if (!(test-path $script)) {copy update.vbs -destination $destination -ea 0
> > > > > > "File copied to $server" >> "log.txt"}
>
Quote:
Quote:

> > > > > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create("cscript.exe
> > > > > > C:\update.vbs")
>
Quote:
Quote:

> > > > > > }
>
Quote:
Quote:

> > > > > > and usage:
> > > > > > Get-Content hosts.txt | Install-Update
>
Quote:
Quote:

> > > > > > so, the error may be in your VBS file.
> > > > > > --
> > > > > > WBR, Vadims Podans
> > > > > > MVP: PowerShell
> > > > > > PowerShell blog -www.sysadmins.lv
>
Quote:
Quote:

> > > > > > "proxb" <boep...@xxxxxx> rakstija zinojuma
> > > > > > "news:6ac3d60b-5999-4cef-aafa-b9c4afa3000d@xxxxxx"....
>
Quote:
Quote:

> > > > > > > Hi everyone.
> > > > > > > I am pretty much out of ideas on how to remotely execute a vbscript
> > > > > > > that I placed on all of our servers using powershell. *Hereis the
> > > > > > > code I am using:
>
Quote:
Quote:

> > > > > > > Function VerifyScript
> > > > > > > {
> > > > > > > $destination = "\\$server\c$\"
> > > > > > > $script = "\\$server\C$\update.vbs"
> > > > > > > $verify = test-path $script
> > > > > > > If ($verify -match "False")
> > > > > > > {
> > > > > > > xcopy /C update.vbs $destination | out-null
> > > > > > > Write-output "File copied to $server" >> "log.txt"
> > > > > > > }
>
Quote:
Quote:

> > > > > > > }
>
Quote:
Quote:

> > > > > > > Function InstallUpdates
> > > > > > > {
> > > > > > > $wmiprocess = [wmiclass]"\\$server\root\cimv2:win32_process"
> > > > > > > $wmiprocess.create("cscript.exe C:\update.vbs") | out-null
> > > > > > > }
>
Quote:
Quote:

> > > > > > > $servers = Get-Content "host.txt"
> > > > > > > ForEach ($server in $servers)
> > > > > > > {
>
Quote:
Quote:

> > > > > > > VerifyScript
> > > > > > > InstallUpdates
> > > > > > > }
>
Quote:
Quote:

> > > > > > > The script actually runs and does create the cscript process on the
> > > > > > > remote machine, but disappears probably within 4 or 5 secondsand
> > > > > > > nothing happens.
> > > > > > > The update.vbs script is used to install all of the patches downloaded
> > > > > > > from our WSUS server and then creates a log file on another folder
> > > > > > > share.
> > > > > > > It appears that while the script runs the cscript.exe command, it
> > > > > > > ignores C:\update.vbs.
>
Quote:
Quote:

> > > > > > > I've spent a week trying to research a good way to get this
> > > > > > > accomplished but have had less than stellar luck finding anything
> > > > > > > good. *If anyone has any suggestions on what I could try, Iwould
> > > > > > > greatly appreciate it.- Hide quoted text -
>
Quote:
Quote:

> > > > > > - Show quoted text -
>
Quote:
Quote:

> > > > > Thanks, I will give this a shot and see what happens. *I still have a
> > > > > lot to learn about powershell and appreciate all of the support in
> > > > > helping to get this script off the ground and running.
> > > > > I was able to verify that the vbscript works by running it on a couple
> > > > > servers and had no issues with it prior to writing the powershell
> > > > > script to run it remotely.
> > > > > Just to be sure that it was something in the powershell script and not
> > > > > the vbscript, i create a quick vbscript that would just create a text
> > > > > file with a one line sentence on the c:\ of a server. I ran it locally
> > > > > and it worked with no issues, however, once I ran it from the script,
> > > > > it would kick off the cscript process but quit shortly after without
> > > > > leaving a file.
>
Quote:
Quote:

> > > > > I will use your recommendations for the script and will report back
> > > > > the status.
>
Quote:
Quote:

> > > > > Thanks again.- Hide quoted text -
>
Quote:
Quote:

> > > > - Show quoted text -
>
Quote:
Quote:

> > > Thanks Bob,
> > > I had sent another message on here prior to your reply, but for some
> > > reason, it failed to post. *I am going to re-post the message and then
> > > add my reply to you in it...
>
Quote:
Quote:

> > > 'No luck on this. *Just to test it, I used my test.vbs script located
> > > on the C:\ which just creates a text file with a one line sentence:
>
Quote:
Quote:

> > > set ofso = CreateObject("Scripting.FileSystemObject")
> > > set text = ofso.createtextfile("TEST.txt")
> > > text.writeline "This is a test"
>
Quote:
Quote:

> > > I was able to run it locally on the server using both wscript and
> > > cscript. *However when I try to run this line of code in powershell:
>
Quote:
Quote:

> > > $server = "servername"
> > > [void]([wmiclass]"\\$server\root\cimv2:win32_process").Create
> > > ("cscript.exe C:\test.vbs")
>
Quote:
Quote:

> > > The only thing that happens is the command prompt windows opens for a
> > > second and closes along with the cscript.exe process appearing in Task
> > > Manager for a second or two and then disappearing.
> > > It would appear that powershell doesn't want to read anything after
> > > the cscript.exe portion of the script for some reason. '
>
Quote:
Quote:

> > > Bob, *this script is running under a Domain Administrator account that
> > > has Administrator rights on all of the servers that this script will
> > > be eventually hitting and eventually this powershell script will be a
> > > scheduled task running from one server under a service account with
> > > Domain Administrator rights. *Are you talking about running the vbs
> > > script as a scheduled task on the local server as opposed to running
> > > the powershell script to kick off the vbscript? If so, I am trying to
> > > avoid that as we have a lot of servers and this would be no better
> > > than what we do already and our schedule for patching fluctuates to
> > > greatly to set a schedule to run the install script.
>
Quote:
Quote:

> > > Let me know if this makes sense and if not, I will clarify better as
> > > sometimes when I write, I tend to say it for myself to understand
> > > versus everyone else understanding...lol.
>
Quote:
Quote:

> > > Also, I did some more searching and found a link that talks about
> > > running the same command in vbscript:http://blogs.technet.com/heyscriptin...0/29/hey-scrip...
> > > I am going to give this a try in vbscript form first and see if it
> > > works, and if so, maybe see a way to convert this over to powershell,
> > > if possible. Or if anything, call it from powershell with each server
> > > to run against.
>
Quote:
Quote:

> > > Thanks again.- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -
>
Quote:

> > Ok, I was successful in running the script I found to remotely run the
> > vbscript on the remote machine to create a text file. *Here is the
> > script:
>
Quote:

> > strComputer = "servername"
> > Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root
> > \cimv2:Win32_Process")
> > strCommand = "cscript " & Chr(34) & "C:\test.vbs" & Chr(34)
> > objProcess.Create strCommand,null,null,intProcessID
>
Quote:

> > Now I am going to try to convert the 3rd line to powershell and give
> > it a go. *If not, then I will call this script in powershell and try
> > to run it that way.- Hide quoted text -
>
> - Show quoted text -
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
execute mysql query using vbscript VB Script
Can only execute gpg from powershell under MY account PowerShell
In Powershell execute scripts on many remote machines ,Monitor and report back General Discussion
Retrieve information of a remote machine in vbscript VB Script
Execute VBScript from a floating popup menu VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46