Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
ok now it is working. interesting though. if i hit cancel it still proceeds.. is it because the account that i'm logged in with on the PC has admin rights to the domain? i'm thinking yes...
but, it's working now to just one prompt once it is entered....
The BEGIN block is the preferred way, at least until v2 when script cmdlets support actual parameters.
However, setting $cred outside the function, prior to the function running, should also work. With $cred not existing inside the function, PowerShell will go to the parent scope (the script, where $cred is defined) to find it. Jvierra's solution is a *better* one because it keeps the function entirely self-contained.
Thank you! This worked like a charm. I'm learning. Another question.... what Win32 object provides network information and software installed? Also, i'm trying to obtain the Dell server tag. Any ideas? Thank you so much!
BTW, as for a more friendly resource... www.sapienpress.com/powershell2.asp. Highly recommended, at least by me. We have some online training coming up, too - go to the Training Zone on this site and select online training. Pretty affordable, if you're interested.donj2008-03-14 13:16:32
This topic is 15 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.