Getting Started with PowerShell Webcast - Q&A

rated by 0 users
This post has 15 Replies | 3 Followers

Top 10 Contributor
Posts 625
Moderator
ps1 Posted: 03-30-2011 11:14 AM

Use this thread to post your questions from Tobias' recent webcast, "Getting Started with PowerShell" on March 28, 2011.

Not Ranked
Posts 2

How can I pass a password not in clear text?

Top 25 Contributor
Posts 341
Top Contributor

In general, you can't pass clear text passwords - Microsoft consider this a security risk and make it quite difficult. They prefer you use a credential object and create it using New-Credential.

Personally, I find this unhelpful in many cases, and have found a bit of a work around. See my blog post at: http://pshscripts.blogspot.com/2011/03/new-credentialps1.html

 

Hope this helps,

 

Thomas

Not Ranked
Posts 2

I need to pass a SQL user account and password in a powershell script. This is hard coded inside the script. If someone opens the script I would like them to see ******** as the password or something like it.

Top 10 Contributor
Posts 624
Microsoft MVP
Top Contributor

You could try and look at this free tool (which I haven't looked into yet) - it promises to encrypt a script so users would not get to the secrets embedded inside:

http://www.screencast.com/users/paperlessInfo/folders/SoSoft/media/5b327645-4434-4338-893c-9a5a24f24654

And/or you can obfuscate the password which is not 100% safe either but better than clear-text passwords:

http://powershell.com/cs/blogs/tobias/archive/2010/10/22/encrypting-passwords.aspx

 

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: How would you determine when a machine was last rebooted?

WMI can provide that information:

get-wmiobject win32_Operatingsystem | Select-Object LastBoot*

 

To convert the date to a real date, use this approach:

$result = get-wmiobject win32_Operatingsystem

$result.ConvertToDateTime($result.LastBootUpTime)

 

Should you btw be interested in inhouse-training, just drop me a line for more information… ;-)

 

Cheerio,

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: can powershell run something locally on a remote server? do we need to install powershell on the remote server also to run something locally on that remote server?

Yes it can, use Invoke-Command. This type of remoting requires PowerShell V2 on both sides. On the server (target) site, remoting needs to be enabled (Enable-PSRemoting). More info in “Administrators Guide to PS Remoting” on www.powershell.com.

 

Cheerio,

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: How can I check the free disk space of multiple computers? can I use a list (file)?

 

Use this:

Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, FreeSpace, Size

 

Get-WMIObject supports a parameter called –Computername that you can use to specify one or more computers. You can even read them from a file like so:

 

Get-WMIObject Win32_LogicalDisk –computername (Get-Content c:\mycomputers.txt)

 

Cheerio

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: how can a poll each pc to get the version of office on each?

 

There are actually different paths. If PowerShell remoting is enabled on the target machines, then you can use Invoke-Command to remotely execute any PS code you want. You could for example query the registry etc.

Another way would be to use WMI and the Win32_Product class like so:

 

Get-WMIObject Win32_Product –Computer xyz

 

 

This approach does not require PS on the target machines. However, this particular WMI class triggers a Windows Installer Reconfigure which may take some time. Also, the class is an optional component on Windows Server 2008 I believe.

 

Cheerio,

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: is there a way of making a variable contain a real time content, eg in the timestamp example, each time you type $timestamp you get the exact current time

No. Once you assign a value to a variable, it stays the same. You can create a function for this, though:

Function Get-Timestamp { Get-Date –format ‘yyyyMMddHHmmss’ }

 

This way, each time you call Get-Timestamp, you get the current timestamp.

Q: can you run scripts against a remote server using remoting and then process the output or does the whole script have to run on the remote server?

You can do that. Use Invoke-Command –computername xyz –filepath c:\localscript.ps1. The script gets transferred to the remote system, and any results come back to your local system where you can continue to process them.

A: --unanswered--

 

Cheerio

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: How do I get more info about the paid-training for myself? Thanks.

We are offering training throughout Europe. If you are located in the US, then you may want to check out Don Jones’ training classes.

Q: Thanks a lot for sending me this presentation.

 

Q: he should have developed a training video for (1) Windows System Engineer; (2) Exchange Admin.  I'll buy it in a heartbeat.

Thanks. I am doing high level trainings regularly for many mid to large size enterprises in Europe. Creating a training video is a great idea… ;-)

 

Cheerio,

Tobias

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: We're on XP and Server 2003.  Is there any reason NOT to go to PowerShell 2.0?

 

There is no reason why you should not upgrade. The only known issues are with old versions of Exchange 2007. If you applied all updates and service packs then you are safe.

 

Cheerio,

Tobias Weltner

Top 10 Contributor
Posts 625
Moderator

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Q: where do we download the Cmdlets that you made.

You can find the download for the network module here:

http://powershell.com/cs/blogs/tobias/archive/2011/03/09/analyzing-networks-with-powershell.aspx

Q: How much does pwoershell plus cost?

A single user license is USD 199,-. I believe there is a promotion right now, so please visit www.idera.com and check out available discounts.

 

Cheerio,

Tobias Weltner

Top 10 Contributor
Posts 624
Microsoft MVP
Top Contributor

Ok, and I have 3- and 4-day classes, too ;-) however I give classes in Europe only. If you'd like more info, just drop a line at tobias.weltner(AT)email.de

Cheerio

Tobias

Not Ranked
Posts 1

How would I be able to download the .wmv file?

Page 1 of 2 (16 items) 1 2 Next > | RSS
Copyright 2012 PowerShell.com. All rights reserved.