Author Posts

December 20, 2013 at 10:14 am

If I am connected to a system [Enter-PSSession -ComputerName ] and I run a certain command I get an WARNING saying "WARNING: You haven't privileges to make this. Try start an elevated Windows Powershell console." I am a domain admin and my domain account is in the local admin group on the computer. Is there a way to run commands in an elevated console?

December 20, 2013 at 10:56 am

What command are you running? That warning doesn't look like anything I'd expect to see from a command Microsoft provides. It's possible that there's a problem in a script or function, and the error message is somewhat misleading.

If you're using a domain account, UAC (elevation) isn't a factor for remote connections. If you were authenticating as a local account on the remote computer, then there is a setting to filter out the Administrators group membership, which is on by default and might be a factor. (see http://support.microsoft.com/kb/942817)

December 20, 2013 at 11:19 am

I am running one of the commands in the PSWindowsUpdate module. To be more specific I am trying to hide particular updates.

December 20, 2013 at 11:21 am

Please be more specific; which command, and what parameters did you pass it?

December 20, 2013 at 11:32 am

I have connected to the remote machine "C1243-01" from my workstation using the following command:
Enter-PSSession -ComputerName c1243-01

Hide-WUUpdate -Title "*Language Pack"

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Latvian Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target "C1243-01".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): a
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.
parsing "*Language Pack" – Quantifier {x,y} following nothing.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\pswindowsupdate\Hide-WUUpdate.ps1:455 char:10
+ If($Update.Title -notmatch $Title)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException

December 20, 2013 at 11:34 am

Another example:

[c1243-01]: PS C:\Users\emanuelg\Documents> Hide-WUUpdate -KBArticleID KB2483139

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Latvian Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target "C1243-01".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.

December 20, 2013 at 11:58 am

OK, I'm looking through the source code for that module now. I see that the module has remoting capabilities built-in; have you tried running Hide-WUUpdate -Title "*Language Pack" -ComputerName "C1243-01" from your computer, without using Enter-PSSession?

For whatever reason, the error handling code in this part of the module completely throws out the error message and writes that one instead. You can edit this section of Hide-WUUpdate.ps1 to get some more information:

							
If($pscmdlet.ShouldProcess($Computer,"$StatusName $($Update.Title)?")) 
{
    Try
    {
        $Update.IsHidden = $HideStatus
    }
    Catch
    {
        Write-Warning "You haven't privileges to make this. Try start an eleated Windows PowerShell console.`r`nError: $($_ | Out-String)"
    }
								
} #$pscmdlet.ShouldProcess($Computer,"Hide $($Update.Title)?")

I changed $env:COMPUTERNAME to $Computer in the ShouldProcess line (a slight bug in their code, but not something that would affect overall functionality), and added some extra information to the Write-Warning line (everything after the word "console.")

December 20, 2013 at 12:53 pm

Hide-WUUpdate -Title "*Language Pack" -ComputerName c1243-01

Exception calling "CreateInstance" with "1" argument(s): "Retrieving the COM class factory for remote component with CLSID
{4CB43D7F-7EEE-4906-8698-60DA1C38F2FE} from machine c1243-01 failed due to the following error: 800706ba c1243-01."
At E:\Profile\My Documents\WindowsPowerShell\Modules\PSWindowsUpdate\Hide-WUUpdate.ps1:208 char:6
+ $objSession = [activator]::CreateInstance([type]::GetTypeFromProgID("Micro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : COMException

You cannot call a method on a null-valued expression.
At E:\Profile\My Documents\WindowsPowerShell\Modules\PSWindowsUpdate\Hide-WUUpdate.ps1:212 char:5
+ $objSearcher = $objSession.CreateUpdateSearcher()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

December 20, 2013 at 12:56 pm

Looks like that error code is "The RPC server is unavailable." You may have a firewall (including Windows Firewall on the target computer) blocking that traffic.

December 20, 2013 at 1:20 pm

Still getting this error: (I'm purposely using a * wildcard in front of Language Pack in the string so I can hide them all)

Hide-WUUpdate -Title "*Language Pack" -ComputerName c1243-01

parsing "*Language Pack" – Quantifier {x,y} following nothing.
At E:\Profile\My Documents\WindowsPowerShell\Modules\PSWindowsUpdate\Hide-WUUpdate.ps1:455 char:10
+ If($Update.Title -notmatch $Title)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Latvian Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target "MUGL".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.
parsing "*Language Pack" – Quantifier {x,y} following nothing.
At E:\Profile\My Documents\WindowsPowerShell\Modules\PSWindowsUpdate\Hide-WUUpdate.ps1:455 char:10
+ If($Update.Title -notmatch $Title)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException

December 20, 2013 at 1:27 pm

I'm not seeing any new information after that Warning statement; did you make the changes I suggested earlier?

It looks like they're using the Title parameter as a regular expression. It would have been better for them to define that parameter as a [regex] instead of a [string], but you can work with it. If you just pass a value of 'Language Pack', it will match any title that contains those words. The leading asterisk is unnecessary (though if you wanted to use one, you would have to do something like '.*Language Pack' to make it a valid regular expression.)

December 20, 2013 at 1:30 pm

I think I've figured it out. It seems my search criteria was not complete. I was searching for the -Title as "*Language Pack" when the Title is something like (French Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)). This means I need a wild card at the end of my search criteria too ( -Title "*Language Pack*)

December 20, 2013 at 1:32 pm

Based on your reg expression versus mine maybe it is the "double quotes" making it a literal

December 20, 2013 at 1:32 pm

That would be true if they were using the -like operator, but they're using -match. Your Title parameter has to be a legal regular expression, which would be '.*Language Pack.*', though just 'Language Pack' would work fine as well.

December 20, 2013 at 1:33 pm

Single / Double quotes don't matter in this case; the string doesn't contain any characters that would cause a problem either way.

December 20, 2013 at 2:14 pm

I think I spoke too soon. I made the changes to the file on my workstation as well as the remote PC and I still get the following:

[c1243-01]: PS C:\Users\emanuelg\Documents> Hide-WUUpdate -Title 'Language Pack'

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Latvian Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target "C1243-01"
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Czech Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target "C1243-01".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.

December 20, 2013 at 2:22 pm

That's why I suggested this change to Hide-WUUpdate.ps1 earlier. It should give you more information about exactly what error is happening:

							
If($pscmdlet.ShouldProcess($Computer,"$StatusName $($Update.Title)?")) 
{
    Try
    {
        $Update.IsHidden = $HideStatus
    }
    Catch
    {
        Write-Warning "You haven't privileges to make this. Try start an eleated Windows PowerShell console.`r`nError: $($_ | Out-String)"
    }
								
} #$pscmdlet.ShouldProcess($Computer,"Hide $($Update.Title)?")

December 20, 2013 at 2:38 pm

Here you go (Sorry, I missed part of the error line):

[c1243-01]: PS C:\Users\emanuelg\Documents> Hide-WUUpdate -Title 'Language Pack'

Confirm
Are you sure you want to perform this action?
Performing operation "Hide Latvian Language Pack – Windows 7 Service Pack 1 for x64-based Systems (KB2483139)?" on Target
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
WARNING: You haven't privileges to make this. Try start an eleated Windows PowerShell console.
Error: Exception setting "IsHidden": "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
At C:\windows\system32\windowspowershell\v1.0\Modules\PSWindowsUpdate\Hide-WUUpdate.ps1:529 char:10
+ $Update.IsHidden = $HideStatus
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI

December 20, 2013 at 3:28 pm

Out of curiosity, have you tried logging on to this computer directly and running that command? I'm not sure if PS Remoting is a factor here, or if it's just a problem with permissions somewhere.

December 23, 2013 at 8:23 am

I just verified I can run the command locally on the machine, but not using PS Remoting. Is there a way I can use PS Remoting to connect to a machine as the local administrator instead of my domain credentials? I can't seem to successfully connect as the local admin. When I use remote desktop I would do something like %hostname%\administrator but I can't get that to work using PS Remoting.

December 23, 2013 at 8:24 am

When you use PS Remoting does it run powershell in elevated mode?