popunder new

https://www.blogger.com/blog/posts/1739890295310631346

Wednesday, August 31, 2011

VBS Script to force a Wsus update detection on a single computer

This script forces a Windows Update Detection immediately on single computer by inputing either its name or IP.
 ' Force a Windows Update Detection now on single computer by inputing name or IP of computer  
'Script is now ignoring errors. For those who wish to see errors just add a ' to the on error resume next below
on error resume next
strComputer = inputbox("Enter a computer name or IP address to run a WUA detection now","Invoke detectnow")
if strComputer = "" then wscript.quit
Set autoUpdateClient = CreateObject("Microsoft.Update.AutoUpdate",strComputer)
AutoUpdateClient.detectnow()
wscript.echo "All done."

Tuesday, August 30, 2011

VBS Script to Start the remote registry service

This script will allow you to start the Remote Registry Service on any computer by enering its name or IP
 ' RemoteRegistryservicestart.vbs   
' script to Start Remote Registry on strComputer
Option Explicit
Dim objWMIService, objItem, objService
Dim colListOfServices, strComputer, strService, strInput
strInput = False
' Creates the Input Message Box
Do
strComputer = InputBox("Which Machine? "_
," Remote Machine", strComputer)
If strComputer <> "" Then strInput = True
Loop Until strInput = True
' NB Spelling of RemoteRegistry (No space).
strService = " 'RemoteRegistry' "
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _
& strComputer & "rootcimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name ="_
& strService & " ")
For Each objService in colListOfServices
WSCript.Sleep 1500
objService.StartService()
Next
WScript.Echo "Started " & strService & " on " & strComputer
WScript.Quit

VBS Script to Find all Outlook pst files on C and D Drives

This script will find all the pst files on a computers C and D drive (if there is a D). It will create a folder in the root of C called pstlog and save in it the results file with the name pst_files_on_computername . Each pst file found will show its location, name and size. Depending on how many drives and there sizes this scriipt can take up to 10 minutes to complete. Be patient

 'Find all Outlook pst files on C and D Drives  
strComputer = "."
on error resume next
set wshnetwork=createobject("wscript.network")
scomputername=wshnetwork.computername
set wshnetwork=nothing
Const OverwriteExisting = True
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'pst' AND (Drive = 'C:' OR Drive = 'D:')")
If colFiles.Count = 0 Then
Wscript.Quit
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:pstlog")
Set objTextFile = objFSO.CreateTextFile("c:pstlogpst_files_on_" & scomputername & ".txt " , True)
For Each objFile in colFiles
objTextFile.Write(objFile.Drive & objFile.Path & "")
objTextFile.Write(objFile.FileName & "." & objFile.Extension & ", Size ")
objTextFile.Write(objFile.FileSize /1024 & "kb" & vbCrLf)
Next
objTextFile.Close

VBS Script to enable or disable remote desktop on a remote system

For those times when you need to remote into a system and remote desktop is disabled, the below script can come in very handy.

 ' This script will enable or disable remote desktop on a remote system  
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = InputBox("Enter the COMPUTER NAME of the system you would like to enable or disable Remote Desktop: leave as localhost for this computer","Enable or Disable Remote Desktop","Localhost")
If strComputer = "" Then
WScript.Quit
End If
Set StdOut = WScript.StdOut
On Error Resume Next
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & "rootdefault:StdRegProv")
If Err.Number <> 0 Then
WScript.Echo "An error has occurred. You may have mistyped the computer name."
WScript.Quit
End If
strKeyPath = "SYSTEMCurrentControlSetControlTerminal Server"
strValueName = "fDenyTSConnections"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
If dwValue = 1 Then
prompt = MsgBox ("Remote Desktop is Currently disabled. Do you want to ENABLE it?", vbYesNo)
If prompt = vbYes then
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
WScript.Echo "Remote Desktop is now ENABLED on " & strComputer
WScript.Quit
ElseIf prompt = vbNo then
WScript.Echo "Remote Desktop is still DISABLED."
Wscript.Quit
End If
ElseIf dwValue = 0 then
prompt = MsgBox ("Remote Desktop is Currently ENABLED. Do you want to DISABLE it?", vbYesNo)
If prompt = vbYes then
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
WScript.Echo "Remote Desktop is now DISABLED on " & strComputer
WScript.Quit
ElseIf prompt = vbNo then
WScript.Echo "Remote Desktop is still ENABLED."
WScript.Quit
End If
End If

Saturday, August 27, 2011

Using WinRAR SFX to Create a Silent Install Package

WinRAR is a great compression, and though there are many good free compression applications available, its SFX (Self-Extracting Install) feature make it well worth the $29 USD price tag.

I use it almost daily to create silent install of applications that I need to push out to users on the network

In this guide I will show how to create a simple silent install of the popular FTP program called Filezilla

After you have WinRAR installed right click the filezilla installer package and select WinRAR> Add Archive

8-26-2011 9-54-25 PM

In the General pane select Create SFX archive

8-26-2011 10-00-19 PM

WinRAR will automatically crate a sfx exe version. Now right click that and select WinRAR > open with WinRAR

8-26-2011 10-01-54 PM

WinRAR opens with the filezilla setup program inside of it.  Select the SFX icon and then select advanced SFX options.

8-26-2011 10-03-15 PM

In the General Tab we will define the silent switch variable that runs filezilla silently . In this case it is /S so under Run after extraction we type the full filename and the /S switch.

8-26-2011 10-04-58 PM

Under modes we make sure it unpacks to a temporary folder and Hides all displays.

8-26-2011 10-05-40 PM

Under Update we will select the extract and replace files and the overwrite all files (This is done just in case an earlier version may have been copied at some point)

8-26-2011 10-06-00 PM

Finally if we want to customize the icon that the package will use we can add it here.

8-26-2011 10-07-51 PM

Select OK

8-26-2011 10-26-24 PM

The new filezilla silent install package with its customize icon are now  ready for use.

8-26-2011 10-09-01 PM

Make Your Own Offline Installers Using WinRar

In a day and age where upwards of 2 trillion people access the Internet everyday to shop online, check email, play games or work, many software distributors have taken an Internet connection for every computer as a foregone conclusion. As such, publishers are now using online installers for their applications rather than distributing their software on CDs or DVDs. These small executables and installers are nothing but downloaders which connect to the Internet in order to load the actual installation files. But what about that small fraction of people who still have computers without high-speed Internet connections? Even if you save the installer to a flash drive, CD or a floppy disk, you’re still left high and dry once it attempts to connect to the Internet or download a 600 MB installation file over a 56 Kbps dial-up modem.

If this sounds like you, fear not. Today we’ll show you how to create your own offline installers for almost any program using WinRar. Plus, we’ll provide you with some instantly downloadable offline installers for some of the most used apps on the web.

You will need:

  • WinRar – Download Here

  • The program for which you want to create an offline installer already installed on another computer

  • Basic knowledge of 32- and 64-bit architecture regarding Windows Program Files


Locating the Program Files for Your Application


Step 1


To begin, run WinRar as an administrator. To do this, Right-click its shortcut icon (or executable file) and choose Run as administrator. (Skip this if you’re running XP).


Step 2


From within WinRAR, navigate to the directory where the program you want to create an offline installer for is located.



The installation directory for your application will vary depending on whether it’s a 32-bit or 64-bit app. If you’re not sure if you are running a 32-bit version or 64-bit version of Windows, Click Start and Right-click Computer and choose Properties. It’ll be listed next to “System Type.”

For 32-bit Windows operating systems your programs will be in C:Program Files

For 64-bit Windows operating systems, your programs will likely be in C:Program Files (x86). Note, however, that 64-bit Windows systems can run both 32-bit and 64-bit apps, so if it’s not in C:Program Files (x86) check in C:Program Files.

From this folder, look for the name of the application or the name of the publisher. For example, if you’re looking for Photoshop, it’ll be in the Adobe folder, i.e. C:Program FilesAdobeAdobe Photoshop CS5. Some applications aren’t located in sub folders, i.e. C:Program Files (x86)Opera

Step 3


Click the folder that contains the application to select it.


Step 4


Right-click the folder and choose Add files to archive.


Configuring Your Offline Installer


Step 1


The Archive name and parameters window will open. Click the General tab. Check the box next to Create SFX archive.


Step 2


Click the Advanced tab and Click SFX options…


Step 3


In the General tab of the Advanced SFX Options… window, Type the folder path where you’d like the program to install into the Path to extract field. You can choose whichever path you’d like, but the most logical place is in Program Files. You can type it in manually—for 32-bit programs this will be C:Program Files or C:Program Files[developer name]. For 64-bit programs, this will be  C:Program Files (x86) or C:Program Files (x86)[developer name]—or you can Select Create in “Program Files” or type %programfiles% in the field. This will automatically detect the Program Files folder on the target machine. Note: It’s not necessary to add the application name, since you’ll be including the entire folder in the archive.

Also, make sure you Check Save and restore paths.


Step 4


If you’d like to add installation instructions, notes or a custom icon, you can do so in the Text and icon tab. This text will appear when the user runs the offline installer.


Step 5


Click OK to close the Advanced SFX Options windows. Click OK again in the Archive name and parameters window to create the archive.


Testing Your Offline Installer


Once the archiving is complete, your offline installer will appear in the target location. If you didn’t choose one, it’ll be in the same folder as the source folder.



Always test your offline installer before distributing them to your friends, family, co-workers and clients! Find yourself a computer where the application you archived is not installed and test out your installer there. In my test, I found that Skype works just fine with my offline installer and I can freely carry it around on my USB thumb drive just in case.


Conclusion


As you might’ve gathered, this isn’t a perfect solution. Essentially, you’re just making a self-extracting archive that saves the end user from the work of unzipping the file and choosing a directory. There are some pros and cons to this method:

Pros:



  • Quick and easy for you and the end user.

  • Packages all the necessary program files in a single archive for easy copying onto a thumb drive or CD.

  • Install file is its own executable—no need to install WinRAR or any other software on the target computer.


Cons:



  • This method may not work for all applications since some applications require additional integration into Windows (i.e. access to system files, altering of Windows registry keys).

  • Doesn’t automatically create a shortcut on the desktop or in the Start Menu.

  • The program can’t be uninstalled using the Add/Remove Programs dialog. To remove it, you must delete it directly from the Program Files folder.

Thursday, August 25, 2011

Get DaRT to Launch Remote Connections Tools Automatically

Launching the Remote Connection Tool at Startup With a simple configuration file change you can modify our DaRT media to boot directly to the Remote Connection tool. When a connection is established the DaRT boot sequence will continue, leaving all the hard choices for the technician. Note: This method assumes you are using DHCP, otherwise you will need to create a script that assigns a network address before launching the Remote Connection tool. Instructions

  1. From Windows 7 start menu, run “DaRT Recovery Image”.

  2. Go through the wizard up until you get to the “Additional Files” page. Note: Don’t forget to enable Remote Connections or else starting the Remote Connection tool at startup will have no effect.

  3. The “Add additional tools” page in the wizard will allow you to customize DaRT to your heart’s content. At this point click the “Show Files…” button.

  4. Navigate to the WindowsSystem32 directory within this temporary folder

  5. Modify the “winpeshl.ini” file permission to give “modify” permissions to your current user.


Open the “winpeshl.ini” file and modify the file to look like below:
[LaunchApps]
"%windir%\system32\netstart.exe -network -remount"
"cmd /C start %windir%\system32\RemoteRecovery.exe -nomessage"
"%windir%\system32\WaitForConnection.exe"
"%SYSTEMDRIVE%\sources\recovery\recenv.exe"

Save the newly created iso file and extract the wim from it and switch it into your recovery folder as I showed HERE. Now when you startup the PC by pressing F8 and selecting Repair this Computer the remote connection screen starts automatically as shown below. The end user only needs to supply the technician with the Ticket number, IP and Port and he can connect and repair the system. SNAGHTML13f21711 Note: If you cancel the remote connection screen at the local workstation, the script will continue as normal, prompting for a language selection and  administrator password before launching the System Recovery Options Screen.

Wednesday, August 24, 2011

Using Dart 7's Standalone System Sweeper

Microsoft's Standalone System Sweeper has been designed to aid users in starting an infected PC and performing offline malware scans to remove viruses, trojans, rootkits and other forms of malware effectively. It is also used if malware is hindering the user to install or start an antivirus software on the infected system, or if the applications used to detect malware are not able to find the malware on the PC.

Once you have launched Dart, select the Standalone System Sweeper



 

If you haven't updated your definitions in a while, you will be prompted to check for updates.



 

Once your definitions have been updated start a full scan.



 

Windows 7 Advanced Boot Options and Starting Dart 7

Note: The following instructions apply if you setup WinRE to include DaRT from my previous post Check it out here

Start your computer and tap on the F8  key to get to the Advanced Boot Options Screen then choose “Repair your computer”

Advanced_Boot_Options

Since Dart 7 has been added to your default WinRE you now have the option to start network support at the start of WinRE. Choose YES

8-24-2011 2-50-03 AM

In a Windows PE environment your drive mappings will not have the same drive letters and this can be confusing.

Choose YES to remap them

8-24-2011 2-50-13 AM

Select you Language and choose Next

8-24-2011 2-50-23 AM

You’ll notice that DART (Microsoft Diagnostics and Recovery Toolset) has been added to the WinRE menu

Select Microsoft Diagnostics and Recovery Toolset.

8-24-2011 2-51-05 AM

You now have 14 additional tools at your disposal.  My  favorites are below.

Locksmith (for those times when someone messes up their administrator passwords)

Standalone System Sweeper (for that nasty malware that’s difficult to clean while in Windows)

Remote Connections (have the user select this and you can remote in with the Dart Remote connection viewer and fix it all from your desk)

Check this blog if you want to have DaRT automaticaly start Remote Connections

8-24-2011 2-51-20 AM

I will go into more detail on how to use some of these great tools in a future blog.

Adding the DART 7 Recovery Toolset to the Default Windows 7 or Server 2008 R2 Recovery PE

If you want to have access to the broader range of tools that  Microsoft's Diagnostics and Recovery Tools (DART) gives you, then here is way to add these into your default Windows RE

Note that you will need an active Software Assurance (SA) license to each OS that deployed with DaRT.

Creating the Dart 7 ISO Image


Install DaRT 7 from Microsoft Desktop Optimization Pack 2011 R2 (available to customers with active Software Assurance license) on your computer or on computer with DVD burner.



From the Windos start menu  under Microsoft Dart 7 open the DaRT Recovery Image Wizard and  follow these steps to create DaRT 7 ISO image:

On the welcome screen click "Next".



Insert and navigate to Windows 7/Server 2008 R2 media and click "Next".



On the Preparing files screen click on "Next".



Select or exclude the tools that will be included in your ERD image and click on "Next".



Locate the Windows Debugging tools and click on "Next".



Choose if you want to allow Remote Connections and click on "Next".



Choose if you want to update your ERD's Standalone system sweeper and click on "Next".



If you want to add additional drivers, click on Add. Then click on "Next".



On the Additional Files click on "Next".



Note: You can add useful applications and files to your ERD ISO image such as disk imaging utility, corporate antivirus, etc.

To create the ISO image click on "Next".



If you want to burn the ISO into a media set the wizard to your media burner. Click on "Next" to proceed.



Click on "Finish".
Copying the new dart wim file to the hidden Recovery folder

In order to replace the default Windows RE boot image with DaRT, you'll need to use an account with administrative privileges (member of the local Administrators group at least).

In order to perform the replacement, follows these steps:

Open Windows Explorer, click on the ALT key and choose "Folder Options" from the Tools menu.

Choose "Show hidden files, folders and drives" and deselect "Hide protected operating system files (Recommended)"and "Hide extensions for known file types".

First we need to change the folder opens so we can view the hidden recovery folder. Open Windows Explorer, click on the ALT key and choose "Folder Options" from the Tools menu.

Choose "Show hidden files, folders and drives" and deselect "Hide protected operating system files (Recommended)"and "Hide extensions for known file types".

8-24-2011 3-04-08 AM

Click "OK".

Open C: Drive, right-click Recovery folder. Choose "Properties" from the menu.

Select Security tab, and click on "Edit".

On the new windows, click on "Add" and find you user account, then click on "OK".

Assign Allow: Full Control permissions for the specific account and click on "OK".

8-24-2011 3-06-33 AM

Now, as you can see, the C:Recovery folder is accessible to your user account.

8-24-2011 3-09-54 AM

At C:Recovery<UID> you'll find the Winre.wim image file. This is the Windows RE image that has been loaded every time you've chosen to repair your computer from the F8 startup menu.

8-24-2011 3-10-30 AM

Next time you restart your computer press F8 to get to the Advanced Boot Options Screen then choose "Repair your computer"

Advanced_Boot_Options

There's the option to start network support at the start of Windows RE. Choose YES

8-24-2011 2-50-03 AM

In Windows PE your drive mapping will not have the same drive letters and this can be confusing.

Choose YES to remap them

8-24-2011 2-50-13 AM

Select you Language

8-24-2011 2-50-23 AM

You'll notice that DART (Microsoft Diagnostics and Recovery Toolset) has been added to the Windows RE menu

8-24-2011 2-51-05 AM

You now have 14 additional tools at your disposal.  My  favorites are below.

Locksmith (for those times when someone messes up their administrator passwords)

Standalone System Sweeper (for that nasty malware that's difficult to clean while in Windows)

Remote Connections (have the user select this and you can remote in with the Dart Remote connection viewer and fix it all from your desk)

8-24-2011 2-51-20 AM

Reference: http://www.petri.co.il/replace-default-windows-recovery-environment-in-dart.htm