Reply To: Checking if computer does not exists
That worked perfectly. Does the variable “ErrorActionPreference” work different than the common parameter “-ErrorAction”? Thanks for the help.
View ArticleReply To: Checking if computer does not exists
That looks good, I will have to look into it a lot more (just starting to learn powershell). Thank you for your help
View ArticlePowerShell Repair?
Is there a way to repair (or uninstall and reinstall) PowerShell v4? I’m getting the error below when running get-command and would like to set PowerShell v4.0 back to its “factory defaults” so I can...
View ArticleReply To: Get-DSCResource Error
Don, thanks, no I don’t see it. I’m on Windows 7 (x64) not Windows 8.1. BTW, I don’t think this is a DSC issue, I need to get get-command working.
View ArticleRPC Server is unavailable
Hi, This is the script i run $KRErrorLogPreferance = "E:\Education\BIT\MCSA\Powershell\CBT Tool Making Code" function Get-SystemInfo{ <# .SYNOPSIS Quieries critical information from a single...
View ArticleReply To: RPC Server is unavailable
The IP address 127.0.0.0.1 you’ve provided is not valid. One .0 octet too much. Try again with: Get-SystemInfo -IPAddress 127.0.0.1 -Verbose Verify “localhost” address: ping -4 localhost
View ArticleReply To: PowerShell Repair?
John, Uninstalling the Windows Management Framework 4.0 (KB2819745) and reinstalling it after a restart might work (http://www.microsoft.com/en-gb/download/details.aspx?id=40855).
View ArticleReply To: Get-DSCResource Error
John, Uninstalling the Windows Management Framework 4.0 (KB2819745) and reinstalling it (http://www.microsoft.com/en-gb/download/details.aspx?id=40855) after a restart might work for you on your Win7...
View ArticleReply To: PowerShell Repair?
What version of Windows are you using? PowerShell 4.0 is installed by default on Windows 8.1 and Windows Server 2012 R2 – you can’t uninstall it from those machines.
View Articlecmdlets vs functions
Hi, I am learning PowerShell by using CBT PowerShell Ultimate Training by Don Jones. After covering first 62 lessons (nuggets) everything so far is pretty clear because Don explained in details all...
View ArticleReply To: How do I get username in WinRM session?
This still does not give you who logged in though, is not it? You write to event log RunAs account.
View ArticleReply To: cmdlets vs functions
Here’s a link to an overview of writing a Powershell cmdlet: http://msdn.microsoft.com/en-us/library/dd878294%28v=vs.85%29.aspx Basically a true Powershell cmdlet is written in a .NET programming...
View ArticleReply To: ForEach Synatax Error? Unexpected token 'in' in...
Here’s a demonstration that shows how to loop through a collection of files one at a time: foreach keyword: $Files = Get-ChildItem c:\data foreach ($File in $Files) { # do something with each file...
View ArticleReply To: cmdlets vs functions
That’s about right. A cmdlet actually sets the baseline; it can do “everything.” Until we got advanced functions, script was more limited.
View ArticleReply To: How do I get username in WinRM session?
My apologies! I went with what I had done in the past in creating a UI that interfaces with the remote constrained endpoint that utilizes some proxy functions with built-in auditing that writes to the...
View ArticleReply To: How do I get username in WinRM session?
Am I missing something? This information is available inside $PSSenderInfo variable [DNVIISADMIN2]: PS C:\Users\svcacct-manage\Documents> $PSSenderInfo UserInfo :...
View ArticleReply To: calling a function with parameters
thanks guys. now, what if one of the parameters in the function is a switch? just use if-else logic when I call the function at the end of the script?
View ArticleReply To: calling a function with parameters
When you declare a parameter as type [switch], PowerShell will set the corresponding variable to $True or $False inside the function. You either include the parameter when running the function, or you...
View Article