Is Make-Shell deprecated? - powershell

A couple of years ago I used Make-shell to create custom shells with custom cmdlets.
Later I used snap-in technique and I forgot about that option.
Now I should deploy a set of custom cmdlets to a big set of customers, and it would be better to provide a zero-configuration solution; hence, I remembered the custom shell solution and I'm wondering if it is still the best solution in such scenario. It would be helpful also because my cmdlets use WF 4.0, so that the shell should run under latest framework version.
Anyway, I'm a bit scared about support for it: is it still working with Powershell 2.0 functionalities?
Are there alternative ways to easily deploy cmdlets on customers' machines?
Thank you

In PowerShell V2 the alternative are modules.
You can write script modules, binaries modules, manifest modules. Simple to deploy. They are deployed by a simple directory copy. And theoretically may be shared on the Network in a path writen in the environement variable PSModulePath.
According to this StackOverflow entry PowerShell (the engine) runs fine under .NET 4.0.
Make-shell is no longer provided with PowerShell, you can find it if you install the Windows SDK. This article present it as deprecated. But I'am not able to find the information on Microsoft site.

Not sure why you would use makeshell when you can create your own PowerShell "shell" called a host. Have you seen Joel Bennet's PoshConsole which uses .NET 4?
http://poshconsole.codeplex.com/
That said if you really want to use makeshell, I have more recent blog post where I built a new sqlps host with it even
http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/

Related

Automate Power BI Report/Dashboard Deployments

I have always done manual report publishing to PBI work-space and it has worked well. Let's me have better control over;
Publishing
Dashboarding
Collaborating
Securing
I have started a new piece of work and requirements are to have all the above or if not at least publish the reports using automated scripts.
I have googled and I haven't found anything that purely talks about automating using, say Powershell or any other method barring C#.
We have plans to use Powershell scripts to deploy Azure modules and was looking for something similar for PBI as well.
Would appreciate pointers to any script that I can customize and use or a tutorial that explains this process.
Cheers...
You can either use the PowerBI service to automate all of this, which is the referred way, recommended by Microsoft, as seen on https://community.powerbi.com/t5/Desktop/Automation-for-Power-BI-Desktop/td-p/332560, or you can use this python script by dubravcik: https://github.com/dubravcik/pbixrefresher-python

Can you write Windows services in Powershell

I have written a program in PowerShell that loops and checks stuff.
I would like to convert this into a Windows service.
I've created a Windows service (in Admin->Services) but I can't start it.
I'm pretty sure I'm missing the proper interface that the system needs to call into in order to start/stop/pause/etc the service.
I can find plenty of examples when it comes to doing it in VB/C#/MS-lang but nothing about how to do it using PowerShell. Is there any documentation (or preferably code examples) out there to help with this?
There are a few items at issue here:
Are you sure that you really need a service? I agree with the comments about using the scheduler for running periodic tasks. The scheduler can start tasks as Administrator.
Services call a special set of APIs to communicate with the Service Control Manager, so an ordinary program can't be used directly.
The Service Control Manager uses CreateProcessAsUser to start the service process, so you need to point the SCM to an executable binary, as opposed to a script.
If you can't use the scheduler (though I strongly encourage you to try), I suppose that you could write an executable binary that acts as a service. It would then execute PowerShell and your script on your behalf. I'm thinking something like the srvany program that used to be included with the Windows Server 2003 Resource Kit could bootstrap the service for you.
If you absolutly want to execute your PowerShell code into a service, I think you can write a C# service wrapper for PowerShell code.
You found examples of how to create a service with C#, and it's simple to call Powershell from C#. So I'am surprised that as small SrvAny oriented PowerShell does not exists yet.
My advice here, you better rewrite your code in C# as a service.
You can use the Compile Script into Service option of PowerGUI: http://documents.software.dell.com/DOC144271
I think what you are looking for is SrvAny.exe from Microsoft (I don't know that they support it any longer, but it has been around in the Windows 2000 Resource Kit for years. It will essentially turn just about any executable (.exe, .cmd, etc...) into a service. I have VBScripts running as quasi-services using Srvany.exe and it works on Windows 2003 and Windows 2008 (even 64 bit). It is a little limited in that it does not provide 100% service functionality (stopping a running script may be difficult) but if you now a bit about programming and the Windows environment you can adapt it to work pretty well (i.e. it will launch the program after server Restart/Startup as you would likely need from a service. There is some documentation with SrvAny.exe (although it can be a little obtuse and difficult to find). It is however Free and built for Windows so it should work for you.
I agree for simplicity that the Scheduled Task idea is worth thinking about as it is even more simplistic that srvany.exe
http://www.firedaemon.com/
Will allows you start littery anything as a service. There are also free alternatives to this application, that does the same.

Where can I find Azure storage cmdlets for PowerShell?

David Aitken's blog post and another post I cannot find anymore talk about PowerShell cmdlets within a CloudDrive example that let you manipulate Azure storage blobs and queues. Where are these now? He refers (presumably based on Azure SDK 1.0) to a samples.zip file, but my SDK just contains a Windows Azure SDK Samples link. I cannot find CloudDrive there, although it is mentioned in this archive. Unfortunately the associated downloads omit CloudDrive. I feel this must be somewhere really obvious, but I am too stupid to find it.
Check http://www.cerebrata.com/. They have more comprehensive version of Azure Cmdlets. However, it is not free.
http://www.cerebrata.com/Products/AzureManagementCmdlets/Default.aspx
Current version of WASM works with Azure SDK 1.3 and you can download it here.
To install WASM with Azure SDK 1.4 you can use workaround in this blog
If you have access to Remote Desktop to any of the deployed instances to Azure, you can just use cmdlets that are installed there. This is actually much better option if you want to debug your PowerShell script works or confirm how they run in real Azure environment.
You can use Windows Azure PowerShell which is provided by Microsoft. There are many storage PowerShell cmdlet there.
The msdn page is here.
http://msdn.microsoft.com/en-us/library/jj152841.aspx
Download Link: http://go.microsoft.com/?linkid=9811175&clcid=0x409

Replacement for Azure SDK Powershell commandlets for deployments

We've run into an issue with the New-Deployment Azure Powershell commandlet timing out; we've put in a bug report with MS. While they gave us an explanation for it (the path and timeout threshold used to upload through commandlets is different then what's used by the web portal); they don't have a fix for us.
We need to get this running so we can automate our build deployments, so we're looking into developing a custom commandlet to replace New-Deployment using the Azure SDK; hoping this path will not have the timeout issues the commandlet did. But before we go down that route; are there any other scriptable tools I can use to replace the New-Deployment functionality? I looked at Cloudberry for Windows Azure; but that doesn't have a scriptable interface yet.
Any constructive input is greatly appreciated.
If you are developing worker roles, then you can reuse the dynamic assembly loading system that comes with the execution framework of Lokad.Cloud.
Basically, you just have to upload a ZIP archive containing all your DLLs toward the Blob Storage and the framework takes care of the rest. Extra Bonus: worker restart takes about 10s (vs +10min for a classical deployment)
A similar behavior could be obtained with web roles too, but this part hasn't been implemented in Lokad.Cloud yet.
FYI, we solved this issue by writing a custom tool to upload the package with a higher timeout tolerance; as well as using CSManage (http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=windowsazuresamples&ReleaseId=3233) to create the deployment after uploading.

powershell or msdeploy

I am running into a situation where I need to find a better approach to deploy web applications (asp.net to iis6..sorry ruby lovers :( and I was curious what some of you have done? I have seen products out there (Anthill?) but I am really looking for a way that my operations team can script a way to grab zip files (packaged code and assemblies), unzip, deploy to a farm. Anyone have any thoughts or solutions that they may be using?
Supposedly, MSDeploy ships with a PowerShell snapin and cmdlets... so you shouldn't have to choose.
IIS Team Blog: web deployment tool and PowerShell
MSDeploy + PowerShell Blog
The bad news is, I can't find that snapin on my system ;)
You mention a tool that Microsoft has in Beta, msdeploy.exe. Is that not a good choice for you?
On IIS6, the state of the art was adsutil.vbs, iisweb.vbs, iisback.vbs, iiscnfg.vbs, and iisext.vbs or learning an arcane script programming model for IIS.
I think msdeploy will be a large step up from wrapping those primitive utils with powershell and other scripts or batch files, with its "syncing" approach.
Also from VS 2010 standpoint, MSdeploy will be integrated into IDE so that would certainly be the direction to go... Check out Overview Post for Web Deployment in VS 2010.