The Zurich release has arrived! Interested in new features and functionalities? Click here for more

chadlockwood
Kilo Sage

Suppose you downloaded the MID server zip file on a Windows Server 2008 R2 or earlier that was running PowerShell version 2(aka, NOT version 3 or 4). Now I would never make this mistake, but suppose you forgot to right-click that zip file, go to Properties, then click Unblock. Then suppose you extracted all the files, made changes to config files and installed your shiny new MID server, without unblocking all the files; also NOT a mistake I would make but for the sake of argument… Since the MID server service will run and the MID server will appear in your instance as Up/Green, you might not notice until you run Discovery or Orchestration. PowerShell will see those blocked PS1 files and stop cold. Fortunately, included in PowerShell version 3 and later is a cmdlet called Unblock-File. You can simply get a file or a group of files, pipe to Unblock-File, and Viola!


Get-ChildItem C:\temp -Recurse | Unblock-File


But…You don't have version 3 or later, so no Viola for you. Fear not! There is still hope and not in the form of right-clicking and unblocking all 895 files in the agent folder individually.


Quickly get to your real admin machine that IS running PowerShell version 3 or later.

Create a new PSDrive to the remote machine


PS C:\Windows\system32> New-PSDrive -Root \\remoteserver\c$\SN_Dev\agent -Name blockedfiles -PSProvider FileSystem


Change your directory to the new PSDrive


PS C:\Windows\system32> cd blockedfiles:


You should now be able to list the PSDrive contents


PS blockedfiles:\> ls

      Directory: \\remoteserver\c$\SN_Dev\agent

Mode                               LastWriteTime         Length Name                                                                  

----                               -------------         ------ ----                                                                  

d----                 4/10/2014     3:03 PM                       bin                                                                    

d----                 4/10/2014     3:03 PM                       conf                                                                  

d----                 4/10/2014     3:03 PM                       etc                                                                    

d----                 4/10/2014     3:31 PM                       extlib                                                              

d----                 4/10/2014     3:03 PM                       jre                                                                    

d----                 4/10/2014     3:04 PM                       lib                                                                    

d----                 4/10/2014     3:04 PM                       licenses                                                          

d----                 4/16/2014   10:52 AM                       logs                                                                  

d----                 4/10/2014     3:03 PM                       package                                                            

d----                 4/10/2014     3:03 PM                       properties                                                      

d----                 4/10/2014     3:32 PM                       work                                                                  

-a---                 4/10/2014     3:49 PM             5899 config.xml                                                      

-a---                 4/10/2014     3:03 PM                 17 start.bat                                                        

-a---                 4/10/2014     3:03 PM                 16 start.sh                                                          

-a---                 4/10/2014     3:03 PM                 16 stop.bat                                                          

-a---                 4/10/2014     3:03 PM                 15 stop.sh


Use Get-ChildItem to get the contents of the agent folder and pipe those files to the Unblock-File cmdlet


PS blockedfiles:\> Get-ChildItem -Recurse | Unblock-File


And now you get your very own Viola!


Make sure to change drives and remove your PSDrive when you are finished


PS blockedfiles:\> cd c:

PS C:\Windows\system32> Remove-PSDrive -Name blockedfiles

1 Comment
Marcus Fly
Tera Expert

Another handy trick is that you can right click on the .ZIP file you download and unblock that before you extract !