Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


94 posts

Master Geek


Topic # 125745 18-Jul-2013 10:00
Send private message

Hi Lads,

Need a hand,

I need a VBscript. That will unhide a zip file and then unzips it in to the C drive where the zip file it.

We have this zip file on loads of workstations, and need a way to unzip it and run the file I am thinking. The user will be a domain admin, so permissions wont be a issue.

I need a way that is easy and the engineer on site, wont have to do too many tasks.

Would this be the best way to do it, so the engineer doesnt have to do too much, basically I want a one click method that is easy for the engineer.

Create new topic
3286 posts

Uber Geek
+1 received by user: 1789

Trusted
Lifetime subscriber

  Reply # 858559 18-Jul-2013 12:09
Send private message

Not a 2 minute trivial piece of code that someones likely to knock up for you for free (hey you never know, but I wouldn't hold my breath)

TBH your best bet is to try and build it yourself, VBS isn't that hard to learn, and if your in a system admin type job, you should really know how to use it yourself.




Information wants to be free. The Net interprets censorship as damage and routes around it.




94 posts

Master Geek


  Reply # 858571 18-Jul-2013 12:22
Send private message

Hi there,

I know vbscript, just thought that might be a easier appoarch to my issue.

all good I have something in the making at the moment.

Ta

1454 posts

Uber Geek
+1 received by user: 140

Subscriber

  Reply # 858597 18-Jul-2013 13:11
Send private message

As 'lias' says, this is not an easy piece of work, several things spring to mind (having done this type of work before many times)

Target location - what happens in the account doesn't have rights?
What happens if disk space is not available?
What happens in the ZIP file isn't there?
What logging is required?
What happens in no-one is logged in? Does it run as a service account?  if so does it log to the event log?


The actual VBScript to unzip it could be as simple as 1-2 lines, however all the checks will expand it out a lot.  If you want some help I am happy to lend a hand.



94 posts

Master Geek


  Reply # 858613 18-Jul-2013 13:39
Send private message

Cool cheers,

I think I have it sorted with this


Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FolderExists("H:\Test") Then fso.CreateFolder("H:\Test")
set sa=CreateObject("Shell.Application")
set filesInzip=sa.NameSpace("H:\Test.zip").items
sa.NameSpace("H:\Test").CopyHere(filesInzip)


I am going to use the variable %SystemDrive% instead of hardcoding it. I just used H:\ as I was running it of my memory stick.

3286 posts

Uber Geek
+1 received by user: 1789

Trusted
Lifetime subscriber

  Reply # 859607 18-Jul-2013 13:57
Send private message

If your going to roll that to multiple workstations in an enterprise you should probably seriously consider wrapping a fair bit of error checking and logging around that :-)





Information wants to be free. The Net interprets censorship as damage and routes around it.




94 posts

Master Geek


  Reply # 859627 18-Jul-2013 14:10
Send private message

Updated to 
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FolderExists("H:\Test") Then fso.CreateFolder("H:\Test")
set sa=CreateObject("Shell.Application")
set filesInzip=sa.NameSpace("H:\Test.zip").items

Const OverwriteExisting = TRUE

If Not fso.FolderExists("H:\Test") Then
sa.NameSpace("H:\Test").CopyHere(filesInzip)
msgbox "Created!"
else
If fso.FolderExists("H:\Test") Then fso.DeleteFolder("H:\Test")
If Not fso.FolderExists("H:\Test") Then fso.CreateFolder("H:\Test")
sa.NameSpace("H:\Test").CopyHere(filesInzip)
msgbox "All ready created, overwritten!"
End if

Wanted to use the Overwriteexisting bit if it already existed but couldnt get it working so just did the above. Delete folder then create folder.

Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.