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.


TG09

244 posts

Master Geek
+1 received by user: 16


#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
Lias
5655 posts

Uber Geek
+1 received by user: 3978

ID Verified
Trusted
Lifetime subscriber

  #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.




I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup. Opinions are my own and not the views of my employer.




TG09

244 posts

Master Geek
+1 received by user: 16


  #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

timbosan
2199 posts

Uber Geek
+1 received by user: 294

Subscriber

  #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.



TG09

244 posts

Master Geek
+1 received by user: 16


  #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.

Lias
5655 posts

Uber Geek
+1 received by user: 3978

ID Verified
Trusted
Lifetime subscriber

  #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 :-)





I'm a geek, a gamer, a dad, a Quic user, and an IT Professional. I have a full rack home lab, size 15 feet, an epic beard and Asperger's. I'm a bit of a Cypherpunk, who believes information wants to be free and the Net interprets censorship as damage and routes around it. If you use my Quic signup you can also use the code R570394EKGIZ8 for free setup. Opinions are my own and not the views of my employer.


TG09

244 posts

Master Geek
+1 received by user: 16


  #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








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.