Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: Problem setting up dsc

I just so happen to brand new Server 2012 R2 Update 1 box that I built this morning in my lab. It has WMF 4.0 and after downloading the Resource Kit Wave 4 package I can't reproduce the issue. What...

View Article


Detecting param variable input only

I have a script with a standard string param in it. In the script, I want to detect if this string is $null. I've included a script snippet. Rather than using 2 variables, is it possible to set a...

View Article


Reply To: Detecting param variable input only

Nevermind. Posted too soon. $PSBoundParameters['x'] did the trick.

View Article

Reply To: Detecting param variable input only

It's not really a good practice to overwrite the value of a parameter variable like that. Technically, though, you could check the value of $PSBoundParameters['x'] to get at the original argument that...

View Article

Reply To: Detecting param variable input only

Take a look at advanced functions: http://technet.microsoft.com/en-us/library/hh847743.aspx Param ( [parameter(Mandatory=$true)] [ValidateNotNull()] $x )

View Article


Reply To: Variable Output in Email

Thanks Guys – This is what worked for me $managername = get-aduser $listmanager | select-object -ExpandProperty name $body =" Dear $managername, I still have much to do, but I am in the right...

View Article

Reply To: Windows Feature Installs that Require Reboot

HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending

View Article

Managing Hostnames vs. GUIDs on a Pull Server

I'm a bit perplexed that the output of the 'Configuration' keyword in Powershell is a MOF named after the hostname of a node, while a Pull server expects/demands a MOF named after a GUID. The DSC Book...

View Article


Reply To: Managing Hostnames vs. GUIDs on a Pull Server

The purpose of a GUID is so that multiple computers can be told to query the same config, and because GUIDs are – in theory – an easier-to-manage and more-unique identifier than a host name. What...

View Article


Reply To: Testing configurations and other quirks…

I can definitely reproduce it. Happens with a fresh install. I have a gut feeling that it has something to do with the way I'm copying/extracting the module to the machine. I'm copying it over there...

View Article

Reply To: Testing configurations and other quirks…

Well, then let's chase that feeling. Can you delete the copy of the module that's on the server now, and re-extract it **on that machine** rather than copying it over from another? Or go and change...

View Article

Advanced Function Optional Parameter Problem

Hello, I've written an advanced function that creates one or more VMs. I have a mandatory parameter and many optional, with some default values. The problem is with the optional parameters that have...

View Article

Reply To: Advanced Function Optional Parameter Problem

You need to put some logic in your script to not provide the SwitchName parameter is $SwitchName is null. if ($SwitchName) { $params.Add('SwitchName',$SwitchName) } Something along those lines. The...

View Article


Reply To: Advanced Function Optional Parameter Problem

How do you call the function?

View Article

Reply To: Advanced Function Optional Parameter Problem

The problem is probably when you pass a null / empty value to the New-VM cmdlet, based on what I can see so far. You'd need to construct your $params hashtable so that only the defined parameters are...

View Article


Image may be NSFW.
Clik here to view.

Reply To: Testing configurations and other quirks…

Same error… I tried to manually import the module, and I got the pop up saying that executing scripts from the internet is dangerous, blah blah… Use Unblock-File to execute. See attached screenshot…....

View Article

Reply To: Advanced Function Optional Parameter Problem

Thank you a lot, it works! I haven't encountered this amazing technique yet. Thank you for the advice on pipeline imput too!

View Article


Reply To: Testing configurations and other quirks…

You can also set your execution policy to Bypass – that'll stop that prompt, and isn't any "less secure" than Unrestricted. As a note, only IE, Firefox, and Outlook apply that bit to the file header;...

View Article

Reply To: Testing configurations and other quirks…

Try setting to Bypass and doing this again. I'm starting to think this really might be policy-related – System32 has some immunities, which is why moving it there might be helping. I found...

View Article

Reply To: Testing configurations and other quirks…

Setting the Execution Policy to Bypass did the trick…. Is it possible that the flag is set on the files inside of the ZIP? I downloaded it from here:...

View Article
Browsing all 13067 articles
Browse latest View live